It due to mouse Position not rotating the part correctly, say for a instance, I look forward, it makes the part go either left or right, I look those directions of Left, Right, Back, Forward the rotation is opposite, making the part rotation the opposite of what I wanted I been using CFrame.lookat and it doesn’t do what I want, ignore the camera thingy it was experiment trying to get it to work.
Remote.OnServerEvent:Connect(function(Player, mouse) -- mouse.Hit
-- Get the character and humanoid root part
local Char = Player.Character or Player.CharacterAdded:Wait()
local HRP = Char:WaitForChild("HumanoidRootPart")
warn("Activated")
-- Calculate the shooting direction from camera to mouse position
local camera = workspace.CurrentCamera or workspace.Camera
local shootDir = (mouse.Position - camera.CFrame.Position).Unit -- Normalize for consistency
-- Create a CFrame representing the spear's orientation
local hitCFrame = CFrame.lookAt(HRP.Position, HRP.Position + shootDir, Vector3.new(0, 1, 0))
-- Clone the spear, set properties, and parent it to debris
local part = script.Spear:Clone()
part.CanCollide = false
part.CanTouch = true
part.Massless = true
part.Anchored = true
part.CFrame = hitCFrame
part.Parent = workspace.Debris
end)