So today I was trying to make a sort of small competition with a countdown. Here are my current scripts:
Server Script that counts down and sends out a remote event to the local script below this code
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.ArenaEvent
wait(5)
for x=10,0,-1 do
wait(1)
print("Sending information to all Clients")
RemoteEvent:FireAllClients(x)
end
Local Script that receives the data and changes the Textlabel's text
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage.ArenaEvent
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player.PlayerGui
local teleportRemoteEvent = ReplicatedStorage.TeleporttoArena
local function onTimerUpdate (x)
playerGui.Competition.Countdown.Text = "Time to next competition: " .. x .. " seconds!"
if x <=0 then
teleportRemoteEvent:FireServer()
end
end
remoteEvent.OnClientEvent:Connect(onTimerUpdate)
My current issue is that I want to teleport all players to the arena, but I am not sure if I can do that through a local script. When I send information from the Server Script, I send it to all clients, but I am not sure if it would stay working on multiple (or any) clients at all if I used a remoteEvent from there.
All help is appreciatedđ