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

How do you make a script that rotates a model when you Onclick?

How do you make a script that Rotates a Model when you use the Onclick function. So basically I need help with creating a script that rotates a Model when you use a Click detector in a Part; so say if I had a Part named (Part1 or whatever) I would click that part and than the Model would Rotate to a certain amount. I have been messing up on this all day so please help if you can (;.

1 comment

0

Post the script that you've tried, then we can help you with what needs fixing.

2 answers

You can just add the Rotating Brick Script in a Model, I have one and i got it in the Adventure Kit 4.0 by Tylermcbride

You can't "rotate" a model but only the parts inside it I'm afraid. To do that you need a script and a ClickDetector inside the model and try this:

--You can add more parts if you want.
Part1 = script.Parent.NAME
Part2 = script.Parent.NAME
Part3 = script.Parent.NAME
Part4 = script.Parent.NAME

function Rotate()
for r = 1, 100 do
	Part1.CFrame = Part1.CFrame *CFrame.fromEulerAnglesXYZ(0, 1, 0)
	Part2.CFrame = Part2.CFrame *CFrame.fromEulerAnglesXYZ(0, 1, 0)
	Part3.CFrame = Part3.CFrame *CFrame.fromEulerAnglesXYZ(0, 1, 0)
	Part4.CFrame = Part4.CFrame *CFrame.fromEulerAnglesXYZ(0, 1, 0)
end

script.Parent.ClickDetector.MouseClick:connect(Rotate)

I hope this works, if not try the answer above.

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