How do i set the part's cframe without affecting the orientation of the arrow tool

You can write your topic however you want, but you need to answer these questions:
Im trying to make the arrow’s orientation match the orientation of the handle. I almost got it but whenever i fired at a wall, the arrow tool was positioned ontop of the wall. I was using :MoveTo() at that time. So i tried to use :SetPrimaryPartCFrame() and it just affects the orientation of the arrow tool. How can i fix this?

local arrow = game.ReplicatedStorage.Ammoitems:WaitForChild("Arrow"):Clone() 

arrow.Parent = workspace.Ammotools 

arrow:PivotTo(script.Parent.Handle.CFrame.Rotation)

arrow:SetPrimaryPartCFrame(CFrame.new(result.Position))

What the arrow is supposed to be oriented like
whatitssupposedtodo

What the arrow is currently oriented like
image_2024-07-11_125800891

1 Like

For some reason, rotation is just a number instead of a vector3.

local position = result.Position
local rotation = script.Parent.Handle.CFrame.Rotation -- get the rotation matrix instead
local cframe = CFrame.new(position) * rotation
arrow:PivotTo(cframe)

This one worked well! Thank you all for helping me out!

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