PlayersHRP.CFrame = CFrame.new(PlayersHRP.Position, TargetsHRP.Position)
--PlayersHRP is the Player's humanoid root part, TargetsHRP is the humanoid root part that the player is trying to align its Y axis to.
The goal is to align the players towards the another player while also allowing them to move freely(while still keeping them faced towards the other player). All answers are appreciated.
You could try a BodyGyro or AlignPosition. I wanna say that a lot of HumanoidRootPart CFraming gets overwritten by the player’s Control Script unless bound to RenderStepped.
I should mention that even with a physics mover, though, that players in first-person will still always face the direction of the camera unless a bigger work-around is used.
If the assembly is moving too slowly, consider lowering the D (dampening) property. Also consider raising the MaxTorque and/or P (power) properties. According to this.
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
wait(5)
local attachment1 = Instance.new("Attachment");
attachment1.Parent = Character.HumanoidRootPart;
attachment1.Position = Character.HumanoidRootPart.Position - Vector3.new(0, -2, -3)
local attachment0 = Instance.new("Attachment", workspace.Pet) -- I have a square named "Pet" in the workspace.
workspace.Pet:SetNetworkOwner(Player)
local alignPosition = Instance.new("AlignPosition", workspace)
local alignOrientation = Instance.new("AlignOrientation", workspace)
alignOrientation.Attachment0 = attachment0 -- Attachment 0's orientation will be the same as attachment 1.
alignOrientation.Attachment1 = attachment1
alignOrientation.MaxTorque = 25000
alignPosition.MaxForce = 25000
alignPosition.Attachment0 = attachment0 -- Attachment 0's position is the attachment 1
alignPosition.Attachment1 = attachment1
end)
end)