I'm trying to clone a part from Replicated Storage to appear locally in front of the player.

function cloneWall()
		local newWall = game.ReplicatedStorage.Builds["Unselected Builds"].Wall:Clone()
	newWall.Hitbox.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.LookVector * 10
	newWall.Parent = workspace.Buildings.Local
	return newWall
end

Small Excerpt from Code ^^^. I'm new to CFrames, so I'm sure I did this completely wrong, but could anyone give me any insight? The goal is to try to make the part position itself to ten studs directly ahead of whatever direction the HumanoidRootPart is facing. What's currently happening is that the part position changes when the player moves (and changes the direction of the HumanoidRootPart) but it moves around 0,0,0. How would I go about fixing this?

2 comments

0

Works fine for me.

1

Make sure the function is in a LocalScript and make sure you actually run the function. I would have done: newWall.Hitbox.CFrame = HumanoidRootPart.CFrame * CFrame.new(0, 0, -3)