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

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

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)


2 comments

0

2 things: Why is the CFrame in a vector3, and 2. Is the part anchored?

0

Dont know and it is anchored

1 answer

✓ Accepted answer

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)

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