Character rotation

How do I make the character rotate like the whole thing at an instant I don’t want a script just wanna know how

You would use player.character:PivotTo( )
inside the pivot to you have a cframe that constains your rotation.
I hope that is enough to get you going in the right direction.

1 Like

Since the player is a model you would have to do what @SelDraken said above but to know what you need to put in is

player.Character:PivotTo(player.Character:GetPivot() * CFrame.Angles(math.rad(180), 0, 0))

180 is the angle you want to turn by
math.rad is used to turn degrees into radians because that is what CFrame.Angles is using

2 Likes

just one last question about the pivot thing when jumping and turning at the same time it semms to return to the ground as fast as it turns what I mean is it teleports to the ground when you turn how would I fix this

You would maybe have to use :SetPrimaryPartCFrame() instead of :PivotTo()or it could be down to lag, are you using this on a server script?

1 Like

yes its on server script and I can assure its not lag

so what is set primary cframe?

Tbf I think is something to do with latency since the server will always have slight latency on the player’s position compared to the client meaning it sets it back to the ground.

However PivotTo I think has some weird behaviour with grounding

Its basically the same but it bases its location on the Model.PrimaryPart property

player.Character:SetPrimaryPartCFrame(player.Character:GetPrimaryPartCFrame() * CFrame.Angles(math.rad(180), 0, 0))

Here it is replaced, SetPrimaryPartCFrame forces the position even if its inside a part or so, so it might be the solution.

1 Like

same issue lol no difference lol

I think the problem is when I jump and turn at the same time it gets the pivot and therefore im teleported to the original spot before jumping because it gets the Cframe before I jump and I just dont know how to solve it

here is the entire script

local Movement = game.ReplicatedStorage.RemoteEvents.Movement -- remote event, the remote evnt here is used to detect when the player is turning from the local side

local function Turn(player, Direction, CurrentDirection)
	player.Character:PivotTo(player.Character:GetPivot() * CFrame.Angles(0, math.rad(-180), 0)) -- this is the magic line where the player turns and here is where the solution and problem will be most likely
	end
end


Movement.OnServerEvent:Connect(Turn)

server side

Ah well theres no need to use remotes to replicate character movements on the server. The character movements are already replicated regardless, wherever you have this event fired on the local script can just be replaced by the code. You don’t need to worry about the movement not replicating to the server since it already does.

1 Like

ok ill do that if it works then it was lag lol,

Ur literally him

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.