Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does Messager Service not work after player leaves?

Asked by 2 years ago
Edited 2 years ago

I'm trying to make a script that makes it so when somebody clicks a button a part spawns in every server and stays there even if there are no servers. A simple example would be when I would spawn a block, leave and then join a new server there would be no block. I don't know if it is even possible, but I don't really know.

Please Help.

local MessagingService = game:GetService("MessagingService")
local Click = game.Workspace.Part.ClickDetector
local success,errormessage = pcall(function()

    MessagingService:SubscribeAsync("Global",function(msg)
        local Part = Instance.new("Part",game.Workspace)
        Part.Name = "Start"
    end)
end)
wait(2)
local success,errormessage = pcall(function()
    Click.MouseClick:Connect(function()
            MessagingService:PublishAsync("Global","part")
    end)
end)

Answer this question