Hello, how do you make a racing event for every 10 minutes that will prompt every player to join the race and with a countdown to 10 seconds remove the prompt and then start the race? I have no idea what to search so I can’t find solution. I’m not that experienced yet so help would be great,
serverscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local joinRaceEvent = ReplicatedStorage.Remotes.JoinRaceEvent
local playersInRace = {}
while true do
task.wait(30)
print("started")
joinRaceEvent:FireAllClients()
print("passed")
joinRaceEvent.OnServerEvent:Connect(function(player)
if player then
table.insert(playersInRace, player)
end
end)
print("passed2")
print(playersInRace)
--I have no idea what i'm doing
end
local:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer
local gui = script.Parent
local raceFrame = gui:WaitForChild("RaceFrame")
local timer = raceFrame:WaitForChild("Timer")
local joinButton = raceFrame:WaitForChild("JoinButton")
local remotes = ReplicatedStorage:WaitForChild("Remotes")
local joinRaceEvent = remotes:WaitForChild("JoinRaceEvent")
local raceTimer = remotes:WaitForChild("RaceTimer")
joinRaceEvent.OnClientEvent:Connect(function()
print("race prompt started")
gui.Enabled = true
for i = 10, 0, -1 do
timer.Text = i
end
gui.Enabled = false
print("race join prompt end")
end)
joinButton.MouseButton1Click:Connect(function()
joinRaceEvent:FireServer()
print("fired")
end)