Gate Script broken

Hi!
For some reason, my Gate gets stuck going up. What is wrong?


No console errors

script.Parent.Parent.Left1.Engine.BodyVelocity.velocity = Vector3.new(0,7,0)

script.Parent.Parent.Light.Green.SurfaceGui.Enabled = true

script.Parent.Parent.Light.Red.SurfaceGui.Enabled = false

function onClicked()

wait (1)

script.Parent.Parent.Left1.Engine.BodyVelocity.velocity = Vector3.new(0,-6.5,0)

script.Parent.Parent.Light.Green.SurfaceGui.Enabled = false

script.Parent.Parent.Light.Green.PointLight.Enabled = false

script.Parent.Parent.Light.Red.SurfaceGui.Enabled = true

script.Parent.Parent.Light.Red.PointLight.Enabled = true

wait (45)

script.Parent.Parent.Light.Green.PointLight.Enabled = false

script.Parent.Parent.Light.Green.SurfaceGui.Enabled = false

script.Parent.Parent.Light.Red.SurfaceGui.Enabled = true

script.Parent.Parent.Light.Red.PointLight.Enabled = true

wait (1.5)

script.Parent.Parent.Left1.Engine.BodyVelocity.velocity = Vector3.new(0,-6.5,0)

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
1 Like

Hello, how are you doing?

Are you sure that the gate ins’t colliding with anything nearby it? Is it completely able to go atleast up without any problems or anything like that?

1 Like


In studio:

Without clicking:
image
When you clink:

I would personally tween the gate or manually change its CFrame instead of applying a velocity to it. This would make it certain that the gate would reach where you want it to reach.

1 Like

New problem is after 1 time it stops working. It now closes.