Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to change the distance the doors move apart?

Asked by
p2c2e 3
9 years ago

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

Log in to vote
1
Answered by
lomo0987 250 Moderation Voter
9 years ago

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.

1
Thanks! This really helped. p2c2e 3 — 9y
0
Np, if you want me to explain how the script works, I can. So you understand what everything is on there. lomo0987 250 — 9y
0
Thanks, that would be very helpful. p2c2e 3 — 9y
Ad

Answer this question