I've tried numerous scripts and they aren't working? Can anyone please help??
function DisableDoors(player) player.PlayerGui.TrainDriveGui.Screen.JunctionsTab.LeftDoors.LocalScript.Disabled = true player.PlayerGui.TrainDriveGui.Screen.JunctionsTab.RightDoors.LocalScript.Disabled = true end function EnableDoors(player) player.PlayerGui.TrainDriveGui.Screen.JunctionsTab.LeftDoors.LocalScript.Disabled = false player.PlayerGui.TrainDriveGui.Screen.JunctionsTab.RightDoors.LocalScript.Disabled = false end if script.Parent.BodyVelocity.Velocity == Vector3.new(0, 0, 0) then EnableDoors() else DisableDoors() end
It is because the "if" statement only runs one time, consider putting it in a loop like this:
repeat if script.Parent.BodyVelocity.Velocity == Vector3.new(0,0,0) then EnableDoors() else DisableDoors() end wait() until 1==0
Instead of:
if script.Parent.BodyVelocity.Velocity == Vector3.new(0,0,0) then EnableDoors() else DisableDoors() end
which could only be ran once.
Edit (Suggested by Sarcadistic): As they mentioned, you could use a .Changed event:
script.Parent.Changed:connect(function() if script.Parent.BodyVelocity.Velocity == Vector3.new(0,0,0) then EnableDoors() else DisableDoors() end end)