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

Whenever someone goes near the rotating model it goes above their head?

Hey, I've created a script to rotate a csg object but when a user goes slightly under it, or by chance touches it in a certain position, it raises above the user's head.

What I'm asking is, how do i make the brick rotate without it going upwards when a player is underneath.

Here is the short script:

while true do
	wait()
	script.Parent.Rotation = script.Parent.Rotation + Vector3.new(1.2, 0, 1.2)
end

3 comments

0

Not an answer but, you should add a :Wait() in there else the script will just break.

0

You need to show the script that controls the model's movement. I suspect it's using :MoveTo (though I don't know how it's rotating with that), since using :SetPrimaryPartCFrame does not exhibit the behaviour you described.

0

@chess123mate no, this is the whole script. I'm not moving the object anywhere, only rotating it. @mosskil23 there is a wait, right after the line saying 'while true do'

1 answer

✓ Accepted answer

You should use CFrames.

Setting the position, rotation or size will take Collision into the math, wich will eventualy put it on top.

How to use CFrames:

while true do	
	Part.CFrame = Part.CFrame * 
		CFrame.Angles(
			--math.rad(float) converts radians to degrees.
			math.rad(DegreeYouWant), -- X Rotation in Radians
			0, -- Y Rotation in Radians
			0 -- Z Rotation in Radians
		)

	wait()
end

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