Part Moving Down Randomly

probably an extremely easy solution with something that i’m missing, but for some reason the part that i’m trying to position relative to the player’s head moves downward when the player stands still

this is the code i’m using:

spawn(function()
	game:GetService("RunService").Heartbeat:Connect(function()
		local headCFrame = char.Head.CFrame
		newPart.CFrame = headCFrame + Vector3.new(0, 6, 0)
	end)
end)

Firstly there’s no need for spawn you could just do this:

	game:GetService("RunService").Heartbeat:Connect(function()
		local headCFrame = char.Head.CFrame
		newPart.CFrame = headCFrame + Vector3.new(0, 6, 0)
	end)

The connection by itself shouldn’t yield the current script so there’s no need for a separate thread. Anyways I believe the problem is caused by the part having gravity so it’s still accelerating downwards faster and faster causing it to move down even with the constant CFrame. To solve this just set the part to massless.

newPart.Massless = true
1 Like

Didn’t even think about that, thanks.

It looks like gravity wasn’t the issue since changing massless to true didn’t seem to have any effect on it moving down.

It’s fine since I was going to change it to bodymovers anyways to look less choppy, thanks for the help though.

game.Players.PlayerAdded:Connect(function(Player)
	local Char = Player.Character or Player.CharacterAdded:Wait()
	local Np = Instance.new("Part", workspace)
	game:GetService("RunService").Heartbeat:Connect(function()
		Np.Velocity = Vector3.new(0,0,0)
		--Np.RotVelocity = Vector3.new(0,0,0)
		Np.CFrame = Char.Head.CFrame + Vector3.new(0,5,0)
	end)
end)

Changing the velocity made it stop falling for me

2 Likes