I’ve searched everywhere but every solution doesn’t work for me. I’m trying to set the characters position but I want to keep the rotation of the character. How can I do this? All help is greatly appreciated thank you!
MoveTo
You can just use Model:MoveTo
which uses Vector3
, This is will only Change their Position, and not their Orientation.
Character:MoveTo(Vector3.new(x, y, z))
Keep In mind that I’m not refering to Humanoid:MoveTo()
as thats completely different.
This doesnt work for me and still sets the orientation for some reason.
Can you show what you are doing?
every heartbeat I run code that makes a player follow something for a move in my game.
model.CharPart.AlignPosition.Position = model.CharPart.Position
if (char.HumanoidRootPart.Position - model.CharPart.Position).Magnitude <= 25 then
char:MoveTo(model.CharPart.Position)
end
For some reason it just locks the characters rotation to where ever it was first facing before the heartbeat connection started.
https://gyazo.com/4338c6efd24b8aee153fd046e0a1331c
here is a gif of the actual move to help u better understand what im trying to do.
Basically the wave is meant to change directions based on lookvector which is why I want the rotation to not be set. when I try to change directions you can see it forcing me back.
try
local rad = math.rad
local rot = character.HumanoidRootPart.Orientation
character:PivotTo(CFrame.new(targetPosition)*CFrame.Angles(rad(rot.X),rad(rot.Y),rad(rot.Z))
Position only holds the XYZ coordinates of a player, CFrame includes the axes and angles
char:PivotTo(model.CharPart.CFrame)
I dont want the rotation of the cframe which is why im using position
This does not work as well for some reason. (character limit aaaaa)
If you are using it for a movement thing, why don’t you attach the player to the wave?
The weird thing about this issue is that when its setting the rotation its always in the lookvector of the character when the move started rather than always being the same direction.
Also response to @vParkuu I do use an align position but it lags behind on other clients so setting the position constantly fixes that.
Also another thing to note: There is no other section of code thats setting the cframe that I may have forgotten or something. I know :MoveTo() and the other methods aren’t working because if I completely remove the :MoveTo(pos) and dont set the position at all it works as intended.
Still struggling with this but I found out something weird.
I saw that you can use :TranslateBy() on models to set the position offset.
If I do this char:TranslateBy(model.CharPart.Position) it actually works as intended and doesnt set the rotation! But obviously TranslateBy() uses offsets so it sets the position of the character to far away from the wave but I can fix that by doing this:
char:TranslateBy(model.CharPart.Position - char.HumanoidRootPart.Position)
BUT when I do that the rotations dont save again. This is very annoying and weird.
What could be causing this?