Preventing player from increasing cash locally?

I’ve made a game just for fun and I want to prevent a player from increasing the cash locally, how can I achieve this? The leaderstats is made on server and I know that the cash won’t replicate if the player changes it locally but what I know is that there is a way to prevent this. What can I possibly do?

My leaderstats script:

script.Parent = nil

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	
	     local leaderstats = Instance.new("Folder")
	     leaderstats.Name = "leaderstats"
	     leaderstats.Parent  = player
	
	     local Bucks = Instance.new("IntValue")
	     Bucks.Name = "Bucks"
	     Bucks.Value = 0
	     Bucks.Parent = leaderstats   
	
	     local Deaths = Instance.new("IntValue")
	     Deaths.Name = "Deaths"
	     Deaths.Value = 0
	     Deaths.Parent = leaderstats   
	
	     player.CharacterAdded:Connect(function(Character)
		
          Character.Humanoid.Died:Connect(function()
		     player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1
	
        end)

	end)
	
	     while true do
		   player.leaderstats.Bucks.Value = player.leaderstats.Bucks.Value + 5
	       wait(60)
	end
	
end)

You can just do a request to the server by using the remote events function

1 Like

Ah yes, thanks. ( 30 characters)

Whenever someone mentions something client/server related, the answer isn’t directly “use remote events”, that’s a sign of not trying to understand what the problem is about.

As for the problem, assuming this script is in the server side you should be good to go. And don’t worry about the exploiter changing his money locally, that won’t have any effects on the server, and it would still show up as the same in the server. From what I understand, your question is about how to stop an exploiter from increasing his money, even though it’s not replicating and all is good. The answer is you simply can’t. The client is a warzone that the exploiter can do whatever he wants in. Not just roblox, many games aren’t able to stop it from happening. But again, since the money is not replicating, everything is good, this is exactly why FilteringEnabled is so important, and managing your client/server model correctly is essential.

Although watch out, try your best to keep everything currency related in the server. For example if the player was supposed to collect coins that give him money, don’t handle that on the client then fire to the server telling it to add an amount of money, an exploiter can simply change the amount of money that coin gives and he’ll be given that amount. Also don’t make shops client-sided, meaning don’t do the purchases and everything with localscripts, since the exploiter’s money is changed locally, the local shop will actually see the local version of the money, and not the actual server version.

5 Likes

its the best answer when it’s about client/server related

Remote Events are the best for exploit’s to get removed i think that’s enough

No it’s not. In fact it makes it worse. If you handle currency with remote events, an exploiter can simply change the arguments, fire a remote event multiple times, mess with the amount of money he gets. It’s almost like you gave him a free ticket to the server side.

2 Likes