I have a script which kills the player if the player has a certain GUI still open. Afterwards, the timer is supposed to start (for those who have died and for those who haven't). However, once the player respawns, the timer gets frozen on one value (as in, while the player was dead, the timer would work, but once respawned, it wouldn't). The issue wasn't prominent before I decided to merge timer script and player spawning scripts together, despite both of them running in the character-sided objects! Here is part of a script along with timer:

if gui.CarSpawner.Enabled == true then
	gui.CarSpawner.Enabled = false
	game.Players.LocalPlayer.Character.Humanoid.Health = 0
end

gui.ScreenGui.ChosenGame.TextTransparency = 1
gui.ScreenGui.count.Text = gui.ScreenGui.count.Value.Value

  if gui.ScreenGui.ChosenGame.TextTransparency == 1 then
     gui.ScreenGui.count.TextTransparency = 0
     gui.ScreenGui.count.ImageLabel.ImageTransparency = 0
      for i = 1,120 do
	gui.ScreenGui.count.Value.Value = gui.ScreenGui.count.Value.Value - 1	 
        gui.ScreenGui.count.Text = gui.ScreenGui.count.Value.Value
	wait(1)	
      end
end

2 comments

0

Is this localscript in characterscripts ?

0

This is local script inside StarterGear. I then decided to move it to StarterGui, but to no avail.