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

Time GUI stops working after you die?

Asked by 8 years ago

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)

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? Shawnyg 4330 — 8y
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 lukeb50 631 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

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.

Ad

Answer this question