Simple Ban Script

So there’s people using exploits in my game to glitch items, is there a simple script I can put in the serverscriptserver that bans someone if they have more than 10000000000000000000000000000000 coins.?

1 Like

They’re using this script to claim items

game:GetService(“ReplicatedStorage”).events.MakePurchase:InvokeServer(unpack({
[1] = “Item they want”,
})

1 Like

People should not be exploiting coins in the first place. What is the code on the client to tell the server that they got more coins?

2 Likes

dont make remote events that directly gives items or currency to the one firing, remote events should only be used to fire decisions such as selling an item, and its ur server’s job to check if the item they want to sell* is actually theirs in the first place

1 Like

Your server handler should be verifying that they can actually make the purchase. Here’s how you can do this.

  1. Validate on the client if you want (use a RemoteFunction)
  2. Validate on the server (check if they have enough money, if their level is high enough, etc.)
  3. Depending on if the purchase can be validated or not, return true/false.

Remember to store prices on the server aswell if you aren’t already.

And walah, you shouldn’t have this problem anymore. Remember, never trust the client.

2 Likes

They can’t exploit the coins but they can sell their items for 50% of their cash back and if theyve exploited the items then can sell them.

1 Like

You should perform this check on the server instead, so they cannot exploit it.

1 Like

It’s a band-aid solution for cheating.

local MAX_COINS = 20000000000000000

local DataStore = game:GetService("DataStoreService"):GetDataStore("CheatBans")

local function validateCoins(player: Player, amountOfCoins: number)
	if amountOfCoins > MAX_COINS then
		DataStore:SetAsync(player.UserID, true)
		player:Kick("You're banned.")
	end
end

local function onInvoke()
	validateCoins(...)
	-- do all of your code
end

game:GetService("Players").PlayerAdded:Connect(function(player: Player)

	if DataStore:GetAsync(player.UserID) then
		player:Kick("You're banned for cheating.")
	end
end)

remoteFunction.OnServerInvoke = onInvoke
3 Likes

Awful solution to patch such a critical issue. Fix the remote event itself instead.

This is just for now. We will be fully patching it in the future.

The bans will not persist from server to server.

1 Like

I changed it, thanks
xxxxxxxxxxxx

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