How to change DataStore Currency safely after GUI Button is clicked?

So, I am currently making a Quiz game, and after each correct answer I want to reward the player with currency. The only problem: I don’t know how to safely give the player currency without using a RemoteEvent or RemoteFunction, which the client has access to. I made a function which currently looks like this:

local function correct(credits)
	local plr = game:GetService("Players").LocalPlayer
       --Dont know how to award the player the currency..

^ → This function will be called if a player pressed the right quiz button.

Does anyone know a method how I would award the player the currency without exploiters having easy access to give themself unlimited currency?

Only the server should be able to give currency. If the GiveCurrency function is on the server it will be safe. Also make sure you’re not telling the client which button is the correct one, have the client send their choice to the server and check it there.

1 Like

Thanks for sharing this helpful answer! Definitely helped me out, since I didn’t thought of sending the answers to the server! Thanks!

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