Im making a ui which countdowns from 8 when the server fires a remote event to the client. The first time I fire the remote event from the server, it works. But if I do it a second time the first one is still counting and messes it up.

Code: (local script)

game.ReplicatedStorage.Counter.OnClientEvent:Connect(function(timee)
	local start = 8
	start = timee
	script.Parent.Visible = true
	
	while wait(1) do
		if start == 0 then
			script.Parent.Visible = false
			break
		else
			start = start - 1
			script.Parent.Text = "Blending \n " .. "(" .. start .. " seconds left)"
		end
	end
end)

Im using the server console to fire the remote event to the client

it looks like this: game.ReplicatedStorage.Counter:FireClient(game.Players.ItzLewis99, 8)

2 comments

0

Im not really that good with RemoveEvents and stuff, but i think this link https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events will help.

0

its nothing to do with that