So, before my gate moved perfectly fast and smooth, but not it moves inch by inch very slow and very roughly. This is the code: Anybody know how to fix it?
local trigger = script.Parent
local gate = script.Parent.Parent.Gate
moving = false
open = false
function onClick()
if open == false and moving == false then
moving = true
trigger.BrickColor = BrickColor.new("Bright yellow")
for i = 1, (gate.Size.Y * 10 + 1) do
wait()
gate.CFrame = gate.CFrame*CFrame.new(0, 0.1, 0)
end
moving = false
open = true
trigger.BrickColor = BrickColor.new("Bright red")
elseif open == true and moving == false then
moving = true
trigger.BrickColor = BrickColor.new("Bright yellow")
for i = 1, (gate.Size.Y * 10 + 1) do
wait()
gate.CFrame = gate.CFrame*CFrame.new(0, -0.1, 0)
end
moving = false
open = false
trigger.BrickColor = BrickColor.new("Bright green")
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)

2 comments
I tried this in one of my worlds I think it maybe the place itself is very slow or laggy because I tried the script and it seemed to move smoothly
Ok