Hello!
I am making a product that if you buy it everyone in the server gets an amount of cash in-game for an game-release event! Could I trust firing all clients to give the players cash?
Hello!
I am making a product that if you buy it everyone in the server gets an amount of cash in-game for an game-release event! Could I trust firing all clients to give the players cash?
This does not sound like a good idea at all, unless you just mean to update the cash UI.
Anything data related, should always be handled on the server to prevent exploiters from giving themselves free cash. Anything Local can be easily thwarted with, so it’s best to leave the handling of money to the Server.
Fireallclients is sent via the the server. This would make it safe from hackers.
Everything else @ExcessEnergy has said is correct.
However, it’s not good to fire each client to handle the cash data or DataStoring functions themselves. You should do the processing on the Server, then pass the results to the client, so that each player’s UI can be updated, via RemoteEvent.
I just wanted to make sure I made my point clear.
Mhm, since fireallclients is sent via the server, your processing has to be done on the server before you can use it.
@vSabov You should only use remote events to update the cash UI. The actual storing of cash data should be done on a server script.
You could do a RemoteEvent (Client to Server) where it checks if the purchase is valid (checking if the player has enough money to buy the product) and doing a for _, v in pairs(Players) do
loop then adding their balance through :Increment()
(I assume you use Datastore).
Datastores and handling stats on the client is a bad idea, what if a hacker changes the amount of cash given to something else like this
remoteEvent.OnClientEvent:Connect(function(money) -- imagine money is equal to 1000
-- a hacker can just do
money = 240000000000
wait(.05)
addMoney(player,money) -- a hacker can just do this
end)
So could I do when the onclientevent remote fires I make that fire to the server