I can't deal with CFrames

Hi,
I’m making a placement system where the thing you want to place is constantly in front of you until you place it or cancel, so I made a code which task is to make ladder (which is the thing to place) be in front of player when he is placing it but I messed up CFrames, can someone help?

LadderTool.Equipped:Connect(function()
	LadderClone = ReplicatedStorage:WaitForChild("Ladder"):Clone()
	LadderClone.Parent = LadderTool
	
	activeState.Value = true
	
	local character = player.Character
	
	while activeState.Value do
		LadderClone.Step0.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(character.HumanoidRootPart.CFrame.LookVector*5) * CFrame.new(0, character.Humanoid.HipHeight, 0)
		task.wait()
	end
end)

With this script my placement system is behaving like this:
robloxapp-20221208-2131378.wmv (2.3 MB)

sorry for bad format no time to convert

The * operator for CFrames is relative—so to move forward on the look vector you just do * CFrame.new(0, 0, -5).

1 Like

Try

while activeState.Value do
		LadderClone.Step0.CFrame = character.HumanoidRootPart.CFrame * CFrame.fromEulerAnglesXYZ(0,character.HumanoidRootPart.CFrame.lookVector.Y,0) * CFrame.new(0, character.Humanoid.HipHeight, 0)
		task.wait()
	end
1 Like

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