Track player's position

Hello, I’m having a problem making a part track the player’s position, I’ve tried with Instance.Changed and Instance:GetPropertyChangedSignal, but they both didn’t work. I made a simple script that actually worked:

        repeat  	
			local originalpos = hum.Position -- Save original position.
			wait(0.01)
			if hum.Position ~= originalpos then -- Position change.
				
				trackplayer() -- Function that makes certain part follow the player.
				
			end
			
		until t == 1

But it’s not very accurate, any ideas?

If you want it to fire only when the player is moving, you can use the HumanoidStateType for running to detect whether or not the player is moving.

See: Humanoid | Documentation - Roblox Creator Hub

Also a side note; wait(0.01) is essentially ineffective, because in Roblox the lowest it can be is 1/30th of a second! You can do just wait() to achieve that.

4 Likes

Do animations change the HumanoidRootPart’s BasePart.Velocity?

Thanks for that tip, I thought wait() would wait infinitely !

Im not to sure what to do but use the humanoidRootPart to track them