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

How do I set the rotation of the player?

Not rotate the player (adding rotation) but actually setting the rotation to something (like setting it to 0, 0, 0 would make it completely unrotated). Here is the function I made which doesn't seem to be working too well.

function module.SetPlayerRotation(player, rotation)
	player:SetPrimaryPartCFrame(CFrame.new(player.HumanoidRootPart.Position, Vector3.new(math.rad(rotation.x), math.rad(rotation.y), math.rad(rotation.z))));
end 

EDIT: What I'm trying to do here is set the CFrame of HumanoidRootPart to a new CFrame equal to the current CFrame position, and a new given rotation. The function takes in an argument of a player to change the rotation of, and a rotation to set the player to.

1 comment

0

instead of "player" you should be doing "player.Character"

1 answer

✓ Accepted answer

There are many types of CFrame values you can set, you can see them all here: http://wiki.roblox.com/index.php?title=CFrame

CFrames are fairly complex, so for what you are doing you could always make a BodyGyro and change the orientation of the player with that. BodyGyro is an object and can be created with the Instance.new() function.

2 comments

0

If you still want to use CFrame, you would probably use CFrame.Angles()

0

not useful and not what he's looking for

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