Previously, I forgot to bring the script, so I’ll put the “Ready” button here as well.
Here Button Ready Handler
local plrs = game:GetService("Players")
local rep = game:GetService("ReplicatedStorage")
local plr = plrs.LocalPlayer
local SentPlayerStatus = rep:WaitForChild("SentPlayerStatus", 5)
local playerStatus = plr:WaitForChild("PlayerStatus", 5)
local isReady = playerStatus:WaitForChild("IsReady", 5)
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
if not isReady.Value then
SentPlayerStatus:FireServer(true, plr.DisplayName)
else
SentPlayerStatus:FireServer(false, plr.DisplayName)
end
end)
and a update timer in local script
local plrs = game:GetService("Players")
local rep = game:GetService("ReplicatedStorage")
local runs = game:GetService("RunService")
local plr = plrs.LocalPlayer
local SentPlayerStatus = rep:WaitForChild("SentPlayerStatus", 5)
local GameRunningEvent = rep:WaitForChild("GameRunningEvent", 5)
local playerStatus = plr:WaitForChild("PlayerStatus", 5)
local isReady = playerStatus:WaitForChild("IsReady", 5)
local TimerText = script.Parent
local isReady = false
local ServerData = workspace:WaitForChild("ServerData", 5)
local LobbyRunning = ServerData:WaitForChild("LobbyRunning", 5)
local GameRunning = ServerData:WaitForChild("GameRunning", 5)
local ServerData = workspace:WaitForChild("ServerData", 5)
local TimerValue = ServerData:WaitForChild("Timer", 5)
function updateTimer()
TimerText.Text = TimerValue.Value
if TimerValue.Value <= 0 then
GameRunningEvent:FireServer(true)
LobbyRunning.Value = false
GameRunning.Value = true
end
end
updateTimer()
TimerValue:GetPropertyChangedSignal("Value"):Connect(updateTimer)
and timer server
local ServerData = workspace.ServerData
local TimerValue = ServerData.Timer
local intermission = 300
for i = intermission, 0, -1 do
TimerValue.Value = i
task.wait(1)
end
and the last one server side to sent BoolValue to IsReady
local rep = game:GetService("ReplicatedStorage")
local SentPlayerStatus = rep:WaitForChild("SentPlayerStatus", 5)
SentPlayerStatus.OnServerEvent:Connect(function(plr, bool, name)
local playerStatus = plr:WaitForChild("PlayerStatus", 5)
local isReady = playerStatus:WaitForChild("IsReady", 5)
isReady.Value = bool
local AllReady = bool
for i, v in pairs(rep.PlayerIsReady:GetChildren()) do
if v:IsA("BoolValue") and v.Name == name then
v.Value = bool
AllReady = AllReady and v.Value
end
end
if AllReady then
print("Start")
end
end)
Sorry for the long code line. Because I didn’t manage the line of codes as well enough. I apologize here.