Door Script:
if game.Workspace.Game.Value == true then if open == false then for i = 1,100 do DoorB.CFrame = DoorB.CFrame + Vector3.new(0, 14, 0) wait(0.1) end open = true end end
Countdown Script:
if game.Players.NumPlayers <= 1 then script.Parent.Text = "You need 1 more player for the game to begin" end if game.Players.NumPlayers >= 2 then script.Parent.Text = "Welcome to Dark Zone" wait(2) script.Parent.Text = "Pick your team" wait(2) local time = 20 for i = 1, 20 do wait(1) time = time - 1 script.Parent.Text = "You have "..tostring(time).." seconds to pick your team" end script.Parent.Text = "" local time = 10 for i = 1, 10 do wait(1) time = time - 1 script.Parent.Text = "The game will begin in "..tostring(time).." " end game.Workspace.Game.Value = true script.Parent.Text = "Doors opening. Make your way to your bases" end
I have this thing with a countdown, and when it hits 0 it set of a BoolValue to true and I want when the BoolValue (Game) = true then the door moves up 14 studs in height. How come this isn't work?
It doesn't wait for Game.Value
to be true, it just checks whether or not it is whenever the script first runs and then the script stops forever. Solution:
workspace.Game.Changed:connect(function() if workspace.Game.Value and not open then for i=1,100 do DoorB.CFrame=DoorB.CFrame+Vector3.new(0,14,0) wait(.1) end open = true end end)
This tells the Changed event to listen for when workspace.Game.Value changes to true and then runs.