Preventing exploiters to teleport the part that gives cash to them

  1. What do you want to achieve? I want to prevent exploiters to teleport parts that give them for example cash to them

  2. What is the issue? I found out that exploiters could teleport parts to their character, and trigger the Touched Event

Here’s my code inside the part

local debounce = false
script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and not debounce then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 25
        print(player.Name.." completed the obby!")
        hit.Parent.HumanoidRootPart.CFrame = game.Workspace.Start.CFrame + Vector3.new(0,3,0)
        debounce=true
        wait(3)
        debounce=false
    end
end)

You can check their Position every x seconds. Store that and then check it again. If it changes by huge amount (physically not possible to walk). Kick them.

1 Like

No, i mean that the exploiter can teleport the part to themself, and act like they had touched it

Yes. I know. That’s what I said, there is no other easy way.

EDIT: Oh noes, I missed it. I read it wrong. :smiley:

Well you could possibly do the same with the Part. But that could cause some performance issues.

@sebi210 i would tp the player to his old position instead of kicking him
because imagine the guy lags like hell

i don’t think that’s possible with filtering enabled tho
except if it’s a local instance

I don’t really want a while loop checking it because the game is already lagging like hell
also i have multiple reward parts from multiple different obbies,
also the exploiter could kinda delete the localscript checking it

If you handle giving the money to the player and touches on the server, which you should do because on the client the money won’t replicate, and they teleport the part to themselves, they won’t earn the money, since they teleported the part on their client and it hasn’t been changed on the server

Of course, they could still get the money by teleporting themselves to the part and they’ll get it because all clients have network ownership of their characters where physics is calculated on their client, so if they teleport themself to somewhere, it’ll replicate to the server

A counteract of this would be to check their last and current position and see if the distance of the displacement is greater than their walk speed, but you’ll of course need to not take the y-components into consideration, since this could give false positives due to your accelerating velocity when you’re falling due to gravity.

However, these sort of things are susceptible to false positives, like if the player is lagging, they would seem to be teleporting. This is why I wouldn’t advise kicking rather than teleporting the player to their old position, but you could obtain their ping, but that’s extra work for the things you send over the client and server

1 Like

Just do a Magnitude check to see if they’re a reasonable distance from the part when they touch it. They don’t actually teleport the Part on the server, it just registers the Touched event because the client said they touched it.

4 Likes

Invisible Checkpoints? If they go through a checkpoint way to fast, then kick them with the reason: “Your moving a bit too fast.”

Try using the Changed function and pass the part Position property as an argument if the position changes replace it to its old position or disable the cash giving script.

1 Like

@Rare_tendo I dont think you get my idea. There is a Part at the end of an obby, and when u step on it it gives u cash and teleports you to the start.

So what the exploiter could do is to

game.Workspace.Obby1.Finish.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame

To teleport the part to themselves and trugger the touched event and bypassing anti teleport