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

Best method of making this intermission map loader?

Asked by 5 years ago
Edited 5 years ago

Currently I have a screengui with a timer that counts down from 15. I'm not too worried about making the whole thing repeat itself infinitely yet, I'm just trying to get it work once.

01intermissiontime = 15
02local repStorage = game:GetService("ReplicatedStorage")
03local remEvent = repStorage:WaitForChild("IntermissionComplete")
04 
05 
06for i = 15,0, -1 do
07    wait(1)
08    script.Parent.Text = i
09    if i < 1 then
10        remEvent:FireServer()
11        script.Parent.Text = "Game in progress."
12 
13    end
14end

Now this works fine, timer stops, text changes and the event fires, loading the map, but since this is inside StarterGui, it creates this script for everybody each time they join, meaning that this script repeats each time a player joins, and hence the event fires, loading another map on top of the current one.

How can I alter the screengui for everybody's client without having to have the localscript within their startergui?

1 answer

Log in to vote
0
Answered by 5 years ago

You could create a sort of debounce so it only fires once, perhaps like this

1local maploaded = false
2local repStorage = game:GetService("ReplicatedStorage")
3local remEvent = repStorage:WaitForChild("IntermissionComplete")
4remEvent.OnServerEvent:Connect(function()
5    if maploaded == false then
6        maploaded = true
7        --load map
8    end
9end)

Sorry if part of my code doesn't work, I'm on mobile so I can't test it, but this should

0
Works well, but, still, the intermission GUI still counts down from 15 for every player who joins, regardless if the map is loaded or not. BIuehawks 62 — 5y
0
You might want to place a value in the workspace and update the GUI based on the value of it, so that way everyone see's the same intermission countdown, and you would countodwn from a server script jediplocoon 877 — 5y
0
*countdown jediplocoon 877 — 5y
Ad

Answer this question