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

How to change the distance the doors move apart?

Got this script from a sliding door I found, but being me I don't know most of what is going on in the script. I just need to know how and where to change the distance the doors move apart in the script.

door = script.Parent
door1 = door.Door1
door2 = door.Door2
button = door.Button
isopen = door.IsOpen
debounce = door.Debounce

button.ClickDetector.MouseClick:connect(function()
	if (debounce.Value == false) then
		if (isopen.Value == true) then
			isopen.Value = false
		elseif (isopen.Value == false) then
			isopen.Value = true
		end
		button.BrickColor = BrickColor.new("Black")
	end
end)

isopen.Changed:connect(function()
	if (debounce.Value == false) then
		debounce.Value = true
		if (isopen.Value == true) then
			for i=1, 190 do
				door1.CFrame = door1.CFrame * CFrame.new(-0.1,0,0)
				door2.CFrame = door2.CFrame * CFrame.new(0.1,0,0)
				wait()
			end
			debounce.Value = false
			button.BrickColor = BrickColor.new("Bright red")
			return
		end
		if (isopen.Value == false) then
			for i=1, 190 do
				door1.CFrame = door1.CFrame * CFrame.new(0.1,0,0)
				door2.CFrame = door2.CFrame * CFrame.new(-0.1,0,0)
				wait()
			end
			debounce.Value = false
			button.BrickColor = BrickColor.new("Bright green")
			return
		end
	end
end)

1 answer

✓ Accepted answer

Line 24,25 and 34,35 are the lines that make the door move. You can increase the amount that they open by changing the line right above them

for i=1, 190 do

the 190, means that it will do it 190 times before it stops, if you increase that number the doors will move farther apart, if you decrease 190, it will make it so they don't move as far apart.

3 comments

1

Thanks! This really helped.

0

Np, if you want me to explain how the script works, I can. So you understand what everything is on there.

0

Thanks, that would be very helpful.

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