So, I have been working on a time limit on my football game, but it won’t work. Here is the script:
local timeLeft = 90
while wait(1) do
timeLeft -= 1
if timeLeft <= 0 then
game.ReplicatedStorage.Remote:FireAllClients()
end
end
game.ReplicatedStorage.Remote.OnClientEvent:Connect(function()
game.ReplicatedStorage.RedGoals.Value = 0
game.ReplicatedStorage.BlueGoals.Value = 0
timeLeft.Value = 90
end)
The resetting of the values doesn’t work.
Any help greatly appreciated!
Extra information: the calling doesn’t work because it used to be >=.
while wait(1) do
timeLeft -= 1
if timeLeft <= 0 then
game.ReplicatedStorage.RedGoals.Value = 0
game.ReplicatedStorage.BlueGoals.Value = 0
timeLeft = 90
end
end
if its inside a server script you cant wait on a clientevent.
Which local script? youre resetting the info for the server, the time is left and the scores for both teams. You dont need a local script. You might want to send a remote event to tell the local players that the ui needs to be reset.