Hi, i'm making a castle gate but when the gate has opended it won't open again.
db = true
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and db == true then
db = false
while wait() do
if script.Parent.Position.Y <= 26.578 and db == false then
script.Parent.Position = script.Parent.Position + Vector3.new(0,0.1,0)
else
wait(7.5)
while wait() do
if script.Parent.Position.Y >= 9.089 and db == false then
script.Parent.Position = script.Parent.Position - Vector3.new(0,0.1,0)
else
if script.Parent.Position.Y == 9.079 then
db = true
break
end
end
end
end
end
end
end)
I checked the positions, they're just fine.

4 comments
are you ever putting the gate down to its original position again
When the gate has finished opening it has 9.079
Lua does poorly with exact numbers, trying checking for a range.
Okay, thanks