plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
part = Instance.new("Part")
part.Anchored = true
follow = false

mouse.Button1Down:connect(function()
	follow = true
	p = part:Clone()
	p.Parent = workspace
	p.Transparency = .5
	p.CanCollide = false
	p.Anchored = true
	mouse.Button1Up:connect(function()
		follow = false
		p.Transparency = 0
		p.CanCollide = true
	end)
	while follow == true do
		game:GetService('RunService').RenderStepped:wait()
		p.Position = Vector3.new(math.floor(mouse.Hit.p.X),(mouse.Target.Position.Y) + (mouse.Target.Size.Y/2)-(1),math.floor(mouse.Hit.p.Z))
	end
end)

this script it sorta like a building script. everything works except for it flickers up and down and i can't figure out why.

the part is supposed be right above the target like this https://i.gyazo.com/937d78e86f20a1344ba5138a1ce48fd3.png

https://i.gyazo.com/03e8146cf60d336244fb2c3141c9483a.gif

it flickers much faster than the gif shows