Skip to content

Commit

Permalink
check if MMS is already enabled upon first loading
Browse files Browse the repository at this point in the history
  • Loading branch information
IconPippi committed Apr 22, 2023
1 parent 19da8f1 commit aa9c9d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin/init.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit aa9c9d3

Please sign in to comment.