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

Time GUI stops working after you die?

So What is happening is that the main script in the serverscriptservice fires an event to all clients when the client script gets the message, a function starts counting down the time. But my problem is, when you die or reset, the timer gui disappears(its invisible by default) and resets to how it was set in studio. How can I work around this?

LocalScript:

RoundLength = 120
game.ReplicatedStorage.length.Value = RoundLength
game.ReplicatedStorage.TimerEvent:FireAllClients(RoundLength)
wait(RoundLength)

ClientScript:

Time = script.Parent

game.ReplicatedStorage:WaitForChild("TimerEvent").OnClientEvent:connect(function(RoundLength)
	if Time.Text ~= "0" then
		for i = RoundLength, 1 ,-1 do
			Time.Visible = true
			wait(1)
			Time.Text = i
		end
	elseif Time.Text == "0" then
		Time.Visible = false
	end
end)

2 comments

0

Just a tip, do not bother people in the community chat to answer your question, especially if you just posted it an hour ago. You need to provide more information to your question. What is the default text value? Have you tried to debug it thoroughly?

1

there is a setting of StarterGui-ResetPlayerGuiOnSpawn, it is true by default but if changed to false, all guis in a player will not be deleted and will act as if the player never died. using this may fix your problem

1 answer

✓ Accepted answer

Here's an idea - When the Player respawns, send the event again to that specific Player, but set the RoundLength to the current round time. Not tracking that on the server? Now's your time to start.

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