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

Can someone help me with my script?

Asked by 10 years ago

I am basically trying to get a brick inside a model called Door1 to Rotate using a click detector, but I continuously mess up on the actual Function(For reasons I do not know). I don't know what the problem is; hopefully you guys can help me out.

function onClicked() script.Parent.Parent.Door1.Rotation=90, -0, 185

end script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 answer

Log in to vote
1
Answered by 10 years ago

The Rotation property is a Vector3 value.

function onClicked() 
script.Parent.Parent.Door1.Rotation = Vector3.new(90,0,185)

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

Also, with rotation and moving parts and such there was something about CFrames... I kind of forgot, heh. You could do something like this -

script.Parent.Parent.Door1.CFrame = script.Parent.Parent.Door1.CFrame * CFrame.new(0,0,0) * CFrame.Angles(math.rad(90),0,math.rad(185))

I think it was that you would use that because if there are parts close to that part, the rotating part won't move out of the way, which was what would happen with Vector3.

0
Isn't math.rad suppost to be math.random? RolandStudio 115 — 10y
0
No, math.rad is different to math.random. Math.rad converts degrees into radians, which are used in CFrame angles. Math.random generates a random integer between one point and another. infalliblelemon 145 — 10y
Ad

Answer this question