From aa9c9d3c65dadc25431ae3859966c9ca8bf2ba29 Mon Sep 17 00:00:00 2001 From: IconPippi Date: Sat, 22 Apr 2023 19:18:04 +0200 Subject: [PATCH] check if MMS is already enabled upon first loading --- plugin/init.server.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/init.server.lua b/plugin/init.server.lua index 353bcb6..f5ea34b 100644 --- a/plugin/init.server.lua +++ b/plugin/init.server.lua @@ -21,11 +21,14 @@ local toggleButton = toolbar:CreateButton("Toggle MMS", "Enables or disables Moc toggleButton.ClickableWhenViewportHidden = true -- if it's a brand new project that has never been exposed to MMS before --- we only want to copy the "require" script, but not the actual library +-- we only want to copy the "require" script, but not the actual library. +-- otherwise we check if MMS is already enabled and set the plugin state accordingly if game.ServerScriptService:FindFirstChild("MessagingService") == nil then local clone = script.Parent.MessagingService:Clone() clone.Parent = game.ServerScriptService game.ServerScriptService.MessagingService.MockMessagingService:Destroy() +elseif game.ServerScriptService.MessagingService:FindFirstChild("MockMessagingService") ~= nil then + enabled = true end local function toggleButtonClicked()