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

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

Asked by 10 years ago

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 (;.

0
Post the script that you've tried, then we can help you with what needs fixing. infalliblelemon 145 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

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

Ad
Log in to vote
0
Answered by 10 years ago

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.

Answer this question