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

Please help me?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I edited the code from last time to make it work better Why doesnt the button work to make the stairs come down? It makes the value true when its finished.

For some reason i cant use block code.

Stair1 = script.Parent.Parent.Stair1 --All the variables
Stair2 = script.Parent.Parent.Stair2
Stair3 = script.Parent.Parent.Stair3
Stair4 = script.Parent.Parent.Stair4
Stair5 = script.Parent.Parent.Stair5
Stair6 = script.Parent.Parent.Stair6
Stair7 = script.Parent.Parent.Stair7
Stair8 = script.Parent.Parent.Stair8
Support1 = script.Parent.Parent.Support1
Support2 = script.Parent.Parent.Support2
Support3 = script.Parent.Parent.Support3
Support4 = script.Parent.Parent.Support4
Support5 = script.Parent.Parent.Support5
Support6 = script.Parent.Parent.Support6
Support7 = script.Parent.Parent.Support7
Support8 = script.Parent.Parent.Support8


value = script.Parent.Value
var = 0
local debounce = false
function onClicked(playerWhoClicked) --Checks if button is clicked
    if not debounce then
        if value.Value == false then --Is the value == false?
            debounce = true
            for i=1,80 do --Does the first Stair
                Stair1.CFrame = Stair1.CFrame + Vector3.new(0,0.1,0)
                Support1.CFrame = Support1.CFrame + Vector3.new(0,0.1,0)
                Stair2.CFrame = Stair2.CFrame + Vector3.new(0,0.1,0)
                Support2.CFrame = Support2.CFrame + Vector3.new(0,0.1,0)
                Stair3.CFrame = Stair3.CFrame + Vector3.new(0,0.1,0)
                Support3.CFrame = Support3.CFrame + Vector3.new(0,0.1,0)
                Stair4.CFrame = Stair4.CFrame + Vector3.new(0,0.1,0)
                Support4.CFrame = Support4.CFrame + Vector3.new(0,0.1,0)
                Stair5.CFrame = Stair5.CFrame + Vector3.new(0,0.1,0)
                Support5.CFrame = Support5.CFrame + Vector3.new(0,0.1,0)
                Stair6.CFrame = Stair6.CFrame + Vector3.new(0,0.1,0)
                Support6.CFrame = Support6.CFrame + Vector3.new(0,0.1,0)
                Stair7.CFrame = Stair7.CFrame + Vector3.new(0,0.1,0)
                Support7.CFrame = Support7.CFrame + Vector3.new(0,0.1,0)
                Stair8.CFrame = Stair8.CFrame + Vector3.new(0,0.1,0)
                Support8.CFrame = Support8.CFrame + Vector3.new(0,0.1,0)
                wait(0.1)
            end
            value.Value = true
            debounce = false
            print("done")
            end
        else if value.Value == true then --Is the value == true?
            debounce = true
            for i=1,80 do --Does the first Stair
                Stair1.CFrame = Stair1.CFrame + Vector3.new(0,-0.1,0)
                Support1.CFrame = Support1.CFrame + Vector3.new(0,-0.1,0)
                Stair2.CFrame = Stair2.CFrame + Vector3.new(0,-0.1,0)
                Support2.CFrame = Support2.CFrame + Vector3.new(0,-0.1,0)
                Stair3.CFrame = Stair3.CFrame + Vector3.new(0,-0.1,0)
                Support3.CFrame = Support3.CFrame + Vector3.new(0,-0.1,0)
                Stair4.CFrame = Stair4.CFrame + Vector3.new(0,-0.1,0)
                Support4.CFrame = Support4.CFrame + Vector3.new(0,-0.1,0)
                Stair5.CFrame = Stair5.CFrame + Vector3.new(0,-0.1,0)
                Support5.CFrame = Support5.CFrame + Vector3.new(0,-0.1,0)
                Stair6.CFrame = Stair6.CFrame + Vector3.new(0,-0.1,0)
                Support6.CFrame = Support6.CFrame + Vector3.new(0,-0.1,0)
                Stair7.CFrame = Stair7.CFrame + Vector3.new(0,-0.1,0)
                Support7.CFrame = Support7.CFrame + Vector3.new(0,-0.1,0)
                Stair8.CFrame = Stair8.CFrame + Vector3.new(0,-0.1,0)
                Support8.CFrame = Support8.CFrame + Vector3.new(0,-0.1,0)
                wait(0.1)
            end
            value.Value = false
            debounce = false
        end
    end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
I don't believe you can make a variable with a number in it. Try using StairOne = and StairTwo = so the script doesn't get confused and try to do math. bloxxyz 274 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Bloxxyz is right, you can't name a part with a number at the end it messes up the whole code. like bloxxyz said, what I do is name it 'PartOne';'PartTwo' and so on...

Ad

Answer this question