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

Sliding Gate | Script Requested (?)

How to script a gate, that slides? I have no clue how to script which explains why I decided to ask the question 'Sliding Gate | Script Requested'

If you can provide me with a script that will cover both gates, thank you.

2 comments

0

wtf?

0

You are requesting which is not allowed.

1 answer

local trigger = script.Parent
local gate = script.Parent

moving = false
open = false

function onClick()
	
	if open == false and moving == false then
		
		moving = true
		
		for i = 1, (gate.Size.Y * 12 + 6) do
			wait()
			gate.CFrame = gate.CFrame*CFrame.new(-0.1, 0, 0)
		end
		
		moving = false
		open = true
		wait(2)
		
		moving = true
		
		for i = 1, (gate.Size.Y * 12 + 6) do
			wait()
			gate.CFrame = gate.CFrame*CFrame.new(0.1, 0, 0)
		end
		
		moving = false
		open = false
		
	end
	
end

script.Parent.ClickDetector.MouseClick:connect(onClick)
------------------------------------------------------------------------------------------
Place this inside your door along with inserting a click detector and you have a fully fledged and functional sliding door

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