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

Help with spinning part OnClick?

Asked by
yoshi8080 445 Moderation Voter
9 years ago

I can't seem to make this part move evenly after the part is click and spins. After I click it it moves from part.Rotation(-180, 0, -180) to part.Rotation(-180, -0.963, -180) I can't seem to make the rotation to (-180,-0,-180) I can't figure this out, please help?

local button = script.Parent.Parent.Button -- Button location
click = button.ClickDetector -- Click Dectector location
function onClicked()        
click.MaxActivationDistance = 0 -- prevents player from clicking check #1
for i=1,63 do
button.CFrame = button.CFrame * CFrame.fromEulerAnglesXYZ(0, .1, 0)
wait(.001)
click.MaxActivationDistance = 0 -- prevents player from clicking check #2
end
wait(20)
click.MaxActivationDistance = 32 -- allows player to click
end
 script.Parent.ClickDetector.MouseClick:connect(onClicked)

Is there any way to make it rotate evenly moving by .1?

Answer this question