How did hackers hack my game?

Yo, recently my World Records board for time was hacked inside of a game I have been working on and I am curious why this is. Is it because hackers are able to move themselves very fast towards a point and I need to make a anti cheat for flying/noclip or is it because my stats are layed out inside the player rather than a module script. Would putting all the stats into a module script prevent this?
Only the PersonalRecords was changed by a hacker.

Anything changed on the client stays on the client. As long as you are not reading the client value (e.g. RemoteFunction), moving it to a module would not help (move it to a module anyway to save on memory).

It seems like you need instead a speed anti-cheat. You can do this on the server.

local players = game:GetService("Players")
local runService = game:GetService("RunService")

local function onJoin(player:Player)
    local character = player.Character or player.CharacterAdded:Wait()
    local hrp = character:WaitForChild("HumanoidRootPart")
    local lastTick = tick()
    local lastPosition = hrp.CFrame.Position
    local strikes = 0
    local connection = runService.Heartbeat:Connect(function(dt) --remember to disconnect this when the player leaves
        local currentPosition = hrp.CFrame.Position
        local currentTick = tick()
        local timePassed = currentTick - lastTick
		local distanceTraveled = (currentPosition - lastPosition).Magnitude

		local speed = distanceTraveled / timePassed
        if speed > 50 then --change to tolerable speed
            strikes += 1
            if strikes > 10 then
                player:Kick("Kicked on suspicion of cheats.")
        lastTick = tick()
        lastPosition = hrp.CFrame.Position


please note this is very basic and probably needs improvement.

1 Like

Cheers, I’m reading nothing off of the client and they didn’t hack any other stats so it must be a speed hack. I will just need to adapt that script so that teleporting the player works.

1 Like

Awesome. I found using an attribute when the player is teleporting and implementing it into a script like that worked really well, if you’re looking for ideas about it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.