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

Countdown Timer Not Working In Real ROBLOX published game, please help?

This is a timer that counts down, it's meant to count down as you can tell, but in the real game, it doesn't count down, I don't understand what is wrong with this. If anyone knows how to fix this that would be greatly appreciated, thank you! I think that in the actual game that the TimeRemaining doesn't even change, this is a problem I do not know how to fix, I don't know if I say ":WaitForChild()" again or just add something else.

local Status = game.ReplicatedStorage:WaitForChild("Status")
local TimeRemaining = game.ReplicatedStorage:WaitForChild("TimeRemaining")

while true do
	wait(1)
	TimeRemaining.Value = TimeRemaining.Value - 1
	TimeRemaining.Changed:Connect(function()
		script.Parent.Text = "Time Remaining Until KOs Turned Into Coins: "..TimeRemaining.Value
	if TimeRemaining.Value < 1 then
		Status.Value = "Reseting KOs..."
		wait(0.6)
		game.Players.LocalPlayer.CoinStats.Value = game.Players.LocalPlayer.leaderstats.KOs.Value / 2
		wait(0.16)
		game.Players.LocalPlayer.leaderstats.KOs.Value = 0
		wait(2.1)
		TimeRemaining.Value = 160
		Status.Value = "Time Remaining Until KOs Turned Into Coins: "..TimeRemaining.Value
	end
	end)
	end

1 answer

✓ Accepted answer

Two things that may be causing your issue,

  1. If you are using a regular Script you can't use the game.Players.LocalPlayer

  2. I don't think you need that .Changed event, you could probably just get rid of the event entirely and get the same outcome. Maybe you're doing something with your waits, but the even seems unnecessary to me.

1 comment

0

Thank you so much!

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