Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

.Changed event does not fire all the time?

Asked by 6 years ago
Edited 6 years ago

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?

0
Are there any errors? Viking359 161 — 6y
0
could you use `:GetPropertyChangedSignal()` creeperhunter76 554 — 6y
0
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. XAXA 1569 — 6y
0
:GetPropertyChangedSignal does not trigger when I move. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Try switching HumanoidRootPart to Torso, it worked perfectly for me.

0
but i want it to be r15 compatible too.................................... hiimgoodpack 2009 — 6y
0
its not just like "Hey this guy's security does not with with r15 lemme switch to r15!" hiimgoodpack 2009 — 6y
0
Use UpperTorso stupid nub greatneil80 2647 — 6y
0
lol Lolamtic 63 — 6y
Ad

Answer this question