Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Best method of making this intermission map loader?

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.

intermissiontime = 15
local repStorage = game:GetService("ReplicatedStorage")
local remEvent = repStorage:WaitForChild("IntermissionComplete")


for i = 15,0, -1 do 
	wait(1)
	script.Parent.Text = i
	if i < 1 then
		remEvent:FireServer()
		script.Parent.Text = "Game in progress."
	
	end
end

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

✓ Accepted answer

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

local maploaded = false
local repStorage = game:GetService("ReplicatedStorage")
local remEvent = repStorage:WaitForChild("IntermissionComplete")
remEvent.OnServerEvent:Connect(function()
	if maploaded == false then
		maploaded = true
		--load map
	end
end)

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

3 comments

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.

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

0

*countdown

This discussion is preserved as it was. New answers, comments, and votes are closed.