Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My gate is not working even though it was before. Anyone know how to fix the script?

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

0

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

0

Ok

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.