Changed Event not detecting players' position

Okay so I am using the Changed/GetPropertyChangedSignal Events to detect when a player moves from their position, but the event doesn’t work in game unless I manually change it in properties :confused: any reason why that is?

2 Likes

can you share the code you have used ?

Sure!

        ChangedSignal = RootPart:GetPropertyChangedSignal('Position'):Connect(function()
			warn(RootPart.Position)
		end)
		
		local Attachment0	= Instance.new('Attachment', RootPart)
		local AlignPosition	= Instance.new('AlignPosition')
			AlignPosition.Mode = Enum.PositionAlignmentMode.OneAttachment
			AlignPosition.Attachment0 = Attachment0
			AlignPosition.Position = GoalPosition
			AlignPosition.MaxForce = math.huge
			AlignPosition.MaxVelocity = 50
			AlignPosition.Responsiveness = 200
			AlignPosition.Parent = Attachment0
		
		

or you can just use Humanoid.Running event

That works until I jump, then… it doesn’t

what about Humanoid.ChangeState ?

Only works when I’m jumping or not running

so you want the function to run when player moves right ?

Changes position to be exact but yea

then you can just do this

game.Players.PlayerAdded:Connect(function(v1)
v1.Character.Humanoid.ChangeState:Connect(function()
-- function body here
end)
end)

yeah but

I guess it should work even with player runs…

or you can use a while loop and check if the MoveDirection is >0

Depending on what you need, you should just use an event from RunService. The player’s position is always changing, even when standing still. That’s the nature of the physics engine.

Then why is the changed event not firing?

1 Like

The changed event isn’t fired by the physics engine, partly because it would be fired every frame.
Just use RunService.Heartbeat:Connect(Blah) for this, it will run at the same time that Changed would have run.

2 Likes