Timer Length:
I am trying to make an intermission and in round timer, but it ended up not working. What did I do wrong?
Timer Length:
I am trying to make an intermission and in round timer, but it ended up not working. What did I do wrong?
Here is the GUI:
What do you mean with “not working”?
Is an error in the output or nothing happens?
After reading both scripts for a while (and doing other things lol), I think the error is in Status
line in the local script due not using the WaitForChild
function.
Also Changed
event has the new value as a parameter so its unnecessary to get the value.
Personally, I would change this:
IntValue.Changed:Connect(function()
print(IntValue.Value)
end)
To this:
IntValue.Changed:Connect(function(newValue)
print(newValue)
end)
You could put a few prints throughout the script to see which line is not working.
Ok, when I finish school I will try these out! Thank you!
Would I have to change these? (InRound, Status)
No
never gonna give you up. 30 chaaars
I am confused on where you found the part you want me to change. I am unable to find it in my script.
never gunna let you down. 30 chaaars
local Status = game.ReplicatedStorage.Status
local TimerDisplay = script.Parent.TimerDisplay
Status.Changed:Connect(function()
TimerDisplay.Text = Status.Value
end)
Change that to this:
local Status = game.ReplicatedStorage:WaitForChild("Status")
local TimerDisplay = script.Parent:WaitForChild("TimerDisplay")
Status.Changed:Connect(function(newText)
TimerDisplay.Text = newText
end)
Is Status
a StringValue
?
I tried your code, noticed that it doesnt work, noticed that Status
was an IntValue, changed it to a StringValue and everything started working.
Let me go on ahead and try that. Still not working for me. I even changed the status to a stringvalue
Do you mind if I see a screenshot of what it looks like?
Once I finish school I will try this out!
local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local inRound = replicatedStorage:WaitForChild("InRound")
local statusMsg = replicatedStorage:WaitForChild("Status")
local lobbySpawn = game.Workspace:WaitForChild("LobbySpawn")
local gameAreaSpawn = game.Workspace:WaitForChild("GameAreaSpawn")
local roundLength = 10
local intermissionLength = 10
local roundPlayers = {}
function startRound()
inRound.Value = true
task.wait(5)
roundPlayers = players:GetPlayers()
if #roundPlayers <= 1 then
statusMsg.Value = "Waiting: 2 or more players are required to start!"
repeat
task.wait()
roundPlayers = players:GetPlayers()
until #roundPlayers >= 2
end
for i, v in pairs(roundPlayers) do
local character = v.Character
local hmr = character:WaitForChild("HumanoidRootPart")
hmr.CFrame = lobbySpawn.CFrame
end
for i = intermissionLength, 0, -1 do
task.wait(1)
statusMsg.Value = "Intermission: ".. i .." seconds left!"
end
for i, v in pairs(roundPlayers) do
local character = v.Character
local hmr = character:WaitForChild("HumanoidRootPart")
hmr.CFrame = gameAreaSpawn.CFrame
end
for i = roundLength, 0, -1 do
task.wait(1)
statusMsg.Value = "Game: ".. i .." seconds left!"
end
statusMsg.Value = "Game: 0 seconds left, the game has ended!"
task.wait(5)
inRound.Value = false
end
task.spawn(function()
while task.wait() do
if inRound.Value then
else
startRound()
end
end
end)
local textBox = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")
local statusMsg = replicatedStorage:WaitForChild("Status")
statusMsg:GetPropertyChangedSignal("Value"):Connect(function()
textBox.Text = statusMsg.Value
end)
Organisation:
Demonstration:
InRound is a BoolValue instance, Status is a StringValue instance. This script is very familiar I must say.
I am going to test these right now!