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

What is a good way to keep a localscript running after a player leaves?

Asked by 9 years ago

Hi. I have a localscript inside a surface gui that is activated when a player presses a text button. The script then constructs a tower over a period of time, maybe around 30 seconds. The problem is that when the player leaves the server while the tower is being built, the script stops running and it leaves the tower that is being constructed in the middle of its construction phase.

Can anybody give me advice on how to stop this problem? Note: The script doesn't have to be a localscript, but it's more convenient if it is.

1 answer

Log in to vote
1
Answered by 9 years ago

You could fire a RemoteEvent that is located on the server.

local Event = ????

script.Parent.MouseButton1Down:connect(function()
    Event:FireServer(Arg1,Arg2)
end)

Server Script:

local Event  = ????

function Event.OnServerEvent(Player,Arg1,Arg2)
    --Stuff
end
0
Ok thanks! whyOmustOitObeOme 7 — 9y
0
Long time no see. EzraNehemiah_TF2 3552 — 9y
Ad

Answer this question