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

When the button moves, why does it turn on its side? [SOLVED]

Asked by 7 years ago
Edited 7 years ago

The button works, and it does move, but it always turns on its side, and I tried to fix that.

button = script.Parent

button.ClickDetector.MouseClick:connect(function()
    if button.CanPress.Value == true then
        button.CanPress.Value = false
        button.CFrame = CFrame.new(Vector3.new(265.625, 4.115, -216.545))
        wait(5)
        button.CanPress.Value = true
        button.CFrame = CFrame.new(Vector3.new(265.625, 4.325, -216.545))
    end
end)


0
2 things: Why is the CFrame in a vector3, and 2. Is the part anchored? shayner32 478 — 7y
0
Dont know and it is anchored GroovyII 4 — 7y

1 answer

Log in to vote
0
Answered by
Yionee 65
7 years ago
Edited 7 years ago

Try this and see if it works. If it doesn't then I'll ask you questions :p

local button = script.Parent
local check = button.CanPress --variables for readability

button.ClickDetector.MouseClick:connect(function()
    if check.Value then -- removed the extra ==true thing
        check.Value = false
        button.CFrame = button.CFrame * CFrame.new(0, -.21, 0) --changed this around a bit
        wait(5)
        button.CFrame = button.CFrame * CFrame.new(0, .21, 0)
    check.Value = true --moved this after the button comes back up
    end
end)
Ad

Answer this question