Part not rotating to players direction

Hi! I’m having a problem with rotating parts to the humanoidrootparts orientation. It’s always not on the same way I’m looking

local rs = game:GetService("ReplicatedStorage")
local event = rs.eSlash

local slash = game:GetService("ServerStorage").WeaponClones.RedSlash
local Tween = game:GetService("TweenService")
event.OnServerEvent:Connect(function(player)
	local Slash = game:GetService("ServerStorage").WeaponClones.RedSlash:Clone()
	local hrp = player.Character:WaitForChild("HumanoidRootPart")
	Slash.Parent = game.Workspace.Ability
	local direction = player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector * player.Character.HumanoidRootPart.Position.Magnitude
	Slash.CFrame = CFrame.lookAt(player.Character.HumanoidRootPart.Position, direction)
end)

Im Pretty sure the direction variable on Magnitude is:

(player.Character.PrimaryPart.Position + player.Character.PrimaryPart.CFrame.LookVector * player.Character.PrimaryPart.Position).Magnitude

I could be wrong as i don’t use magnitude often

Edit: didnt read post

Can you provide a video on what the error is?

I can’t provide you with a video but everytime i slash, the orientation is never in the front

You arent exactly specifying what orientation

Edit: im sorry, im literally bad at reading

1 Like

Do you see in the picture the object is looking a little to the left instead of center, I don’t know how to make it center everytime

The Trail? the Sword? which exactly

The bright red trail is what i’m trying to change, the variable inside the script is “RedSlash”

Im pretty sure you use Orientation instead of Position, or you can change the script at CFrame.lookAt() to the LookVector, i have no idea since its just an image with no video providing any more detail

I didn’t think you needed that much info but don’t worry about it I found the solution, for anyone that might come across this problem, make sure your part is orientated -90 on the y-axis

local rs = game:GetService("ReplicatedStorage")
local event = rs.eSlash

local slash = game:GetService("ServerStorage").WeaponClones.RedSlash
local Tween = game:GetService("TweenService")
event.OnServerEvent:Connect(function(player)
	local Slash = game:GetService("ServerStorage").WeaponClones.RedSlash:Clone()
	local hrp = player.Character:WaitForChild("HumanoidRootPart")
	Slash.Parent = game.Workspace.Ability
	local direction = player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector * player.Character.HumanoidRootPart.Position.Magnitude
	Slash.CFrame = CFrame.lookAt(player.Character.HumanoidRootPart.Position, direction)
	Slash.Orientation = Vector3.new(Slash.Orientation.X,Slash.Orientation.Y+-90,Slash.Orientation.Z)
end)

Now that i look back at the post, i feel like an idiot