I’m trying to make a system that relies on three boolean values in a folder in workspace.
It should be working, there are no errors, the timestamps match up, but the results simply aren’t there.
The idea is a TextLabel on the top of the screen displays the game status and how many seconds until the next one. For some reason, the first one does not start off properly. It is supposed to say “Intermission”…Countdown Value - but it doesn’t. For the other 2 values it works, but on the start it doesn’t.
I have two main scripts here: One controlling what’s actually happening in the game and toggling the booleans at their respective times on the server’s end.
The other is a local script controlling the UI and personal timers.
I understand it is a lot to ask to look through everything, but it would be highly appreciated.
The Server Script
function gameloop()
-- Intermission
workspace.GameStatus.Intermission.Value = true
workspace.GameStatus.Running.Value = false
workspace.GameStatus.InLobby.Value = false
print("Intermission")
wait(15)
print("Players are clicking")
-- Clicking enitiated
workspace.GameStatus.Intermission.Value = false
workspace.GameStatus.Running.Value = false
workspace.GameStatus.InLobby.Value = true
wait(15)
print("Players are running")
-- Running
workspace.GameStatus.Intermission.Value = false
workspace.GameStatus.InLobby.Value = false
workspace.GameStatus.Running.Value = true
-- Apply Walkspeed
for i, v in pairs(game.Players:GetChildren()) do
local s, e = pcall(function()
v.Character.Humanoid.WalkSpeed = v.Speed.Value
end)
end
wait(20)
-- Round end
print("Players sent back to lobby")
for i, v in pairs(game.Players:GetChildren()) do
local s, e = pcall(function()
v.Character.HumanoidRootPart.Position = workspace.TPMAIN.Position + Vector3.new(math.random(1, 6), 5, math.random(1,6))
end)
end
workspace.GameStatus.Intermission.Value = true
workspace.GameStatus.Running.Value = true
workspace.GameStatus.InLobby.Value = true
wait(1)
workspace.GameStatus.Intermission.Value = true
workspace.GameStatus.Running.Value = false
workspace.GameStatus.InLobby.Value = false
end
wait(1)
gameloop()
local LobbyCounter = workspace.Lobby.Counter
The Local Script
local Folder = workspace.GameStatus
local Intermission = Folder.Intermission
local Running = Folder.Running
local Lobby = Folder.InLobby
function DeductTime(Value, Start)
Value.Value = Start
repeat
wait(1)
Value.Value -= 1
until Value.Value == 0
end
-- InterChanger
Intermission.Changed:Connect(function()
if Intermission.Value == true then
DeductTime(script.Parent.InterValue, 15)
end
end)
-- InterUpdater
script.Parent.InterValue.Changed:Connect(function()
if workspace.GameStatus.Intermission.Value == true then
script.Parent.Text = "Intermission: "..script.Parent.InterValue.Value
end
end)
-- RunnerChanger
Running.Changed:Connect(function()
if Running.Value == true then
DeductTime(script.Parent.Runvalue, 30)
end
end)
-- RunnerUpdater
script.Parent.Runvalue.Changed:Connect(function()
if workspace.GameStatus.Running.Value == true then
script.Parent.Text = "Running: "..script.Parent.Runvalue.Value
end
end)
-- LobbyChanger
Lobby.Changed:Connect(function()
if Lobby.Value == true then
DeductTime(script.Parent.ClickValue, 15)
end
end)
-- LobbyUpdater
script.Parent.ClickValue.Changed:Connect(function()
if workspace.GameStatus.InLobby.Value == true then
script.Parent.Text = "Clicking: "..script.Parent.ClickValue.Value
end
end)
Thanks in advance
Best,
Lazl