Part on mouse.Hit CFrame moving to camera

Hello! I am trying to create this survival-type game and I want to create a hammer that spawns a construction part that you can add stuff to to build the building

But when I try to put the construction part on the mouse.Hit CFrame(how placing will work), it zooms to the camera of the player.

I just want it so it just stays at the mouse.Hit CFrame and not move to the camera of the player

(this is my first topic/post so it may look bad :D)

local animation = script:WaitForChild("Animation")
local tool = script.Parent
local player = game.Players.LocalPlayer
local char = game.Workspace[tostring(player)]
local h = char.Humanoid
local animator = h.Animator
local mouse = player:GetMouse()
local RS = game:GetService("RunService")

tool.Activated:Connect(function()
	local LoadedAnimation = animator:LoadAnimation(animation)
	LoadedAnimation:Play()
	local part = Instance.new("Part")
	RS.Stepped:Connect(function()
		part.CFrame = mouse.Hit
	end)
	part.Parent = game.Workspace
end)

You forgot to set the targetfilter; use Mouse.TargetFilter = part. This will prevent it from doing this! :slight_smile:

THANKS! i can’t believe it was that simple!

Yeah, you just needed to exclude the created part from any possible “mouse.Hit” detection.