So, I am trying to make a little anti-cheat, so I came up with seeing how far they moved from the previous time they moved. This sounded like a good idea at first, but this didn't run all the time.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
wait(1)
local lastpos = char.Head.Position
local deb = false
char.HumanoidRootPart.Changed:Connect(function()
local pos = plr:DistanceFromCharacter(lastpos)
if pos > 0.3 and not deb then --I know this sounds a little low, but trust me. You won't pass that from jumping.
deb = true
warn('You seem to be moving really fast at '..pos..'...')
plr:LoadCharacter()
return
elseif not deb then
deb = true
lastpos = char.Head.Position
deb = false
end
end)
end)
end)
This detects the tiniest bit of teleportation (like 2 studs), but it does not fire when I do not teleport, nor when I set up glitchy parts with roblox's terrible physics and fly off the baseplate, but it does not run. In case you need the teleportation part I set up, it is here
game:GetService('UserInputService').InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.E then
game.Players.LocalPlayer.Character.Head.CFrame = CFrame.new(6, 5.5, 58.25)
end
end)
So, why does the .Changed event not detect me when I walk and fly?

4 comments
Are there any errors?
could you use
:GetPropertyChangedSignal()Does player movement even trigger the .Changed event? I don't think it does. Afaik any movement caused by physics does not fire any events. You're probably better off listening to RunService.Heartbeat to check for player movement speed.
:GetPropertyChangedSignal does not trigger when I move.