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

Can someone help me with my script?

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

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.

2 comments

0

Isn't math.rad suppost to be math.random?

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.

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