Make it game.Workspace, not Workspace
And at the bottom, put a bracket after the end.
It still starts when you join the game, it also repeats the timer even if you haven’t pressed the button.
Wait make sure to remove the old script (that was in the text label)
How would I make it that it sets the TextLabel to nothing after it hits 0?
Edited the script, added the part to make it blank.
Change it to that now.
(This -)
It’s not working now? What’s gone wrong?
This is the script for each light.
Light1:
local textLabel = game.Workspace.Light2.Timer.SurfaceGui.TextLabel2
script.Parent.MouseClick:Connect(function()
script.Parent.MaxActivationDistance = 0
script.Parent.MouseClick:Connect(function()
script.Parent.MaxActivationDistance = 0
for i = 15,0,-1 do
textLabel.Text = i
wait(1)
end
textLabel.Text = ""
script.Parent.MaxActivationDistance = 5
end)
Light2:
local textLabel = game.Workspace.Light1.Timer.SurfaceGui.TextLabel
script.Parent.MouseClick:Connect(function()
script.Parent.MaxActivationDistance = 0
script.Parent.MouseClick:Connect(function()
script.Parent.MaxActivationDistance = 0
for i = 15,0,-1 do
textLabel.Text = i
wait(1)
end
textLabel.Text = ""
script.Parent.MaxActivationDistance = 5
end)
Why is this repeated twice?
(In both scripts)
I removed one of them, it’s still not working.
wait its working now bruh :
So is there anything else you need help with? Or is it all good?
I think you have to convert i to a string like so
textLabel.Text = tostring(i)
Well, either way seems to work.
I have two decals,
top one is to say you can cross, the bottom is saying stop.
How can I make it so when the countdown is showing, the green man is there and then when the button hasn’t been pressed, the red man shows?
It is parented by Light1 or Light2 depending on which light.
Uh tell me if this works:
local textLabel = game.Workspace.Timer.SurfaceGui.TextLabel
local green = -- green decal here
green.Parent = nil
local red = -- red decal here
script.Parent.MouseClick:Connect(function()
script.Parent.MaxActivationDistance = 0
green.Parent = red.Parent
red.Parent = nil
for i = 30,0,-1 do
textLabel.Text = i
wait(1)
end
red.Parent = green.Parent
green.Parent = nil
textLabel.Text = ""
script.Parent.MaxActivationDistance = 5
end)
Why is the parent nil for the GreenMan?