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

how do i make a countdown the same for everyone using a remote event?

nothing to say here buster

1 answer

✓ Accepted answer

ANSWER: You need the counter to be on the server. And you need to pass the counter's value through RemoteEvent to the other clients, and not the other way around.

Server Script (Normal Script in the serverscriptservice):

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

local count = 0

while wait(1) do
	count += 1
	print("SERVER COUNT:" .. count)
	RemoteEvent:FireAllClients(count)
end

Client Script (Local Script in the starterplayerscripts):

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

local count

RemoteEvent.OnClientEvent:Connect(function(c)
	count = c
	print("CLIENT COUNT:" .. count)
end)

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