Fix this fire server issue?

I have coins that spawn locally. They are collected locally. How can I update player stats without it being so vulnerable to hacks where you can just put math.huge into the parameter?

	-- AWARD CURRENCY HERE - After all orbs are collected
		if coinValue > 0 then
			-- Award currency on server
			if coinColor == Color3.fromRGB(244, 88, 255) then
				ReplicatedStorage.Remotes.UpdatePink:FireServer(coinValue)
			else
				ReplicatedStorage.Remotes.UpdateGreen:FireServer(coinValue)

			end

			-- Show notification
			if coinColor == Color3.new(1, 0, 0) then 
				coinColor = Color3.fromRGB(245, 95, 95) 
			end
-- local script ^
...
2 Likes

you could “create” and store the coin on the server, add an id to it (GUID, tick(), # table + 1, etc.) and value, then tell the client(s) to build the coin, once the coin is collected you can validate it’s existence, and remove it from the server table
however, you should be mindful on how much data you add to the server table, it may lag your game
i would recommend adding a lifetime and/or a limit

3 Likes

I used remote functions. If your reading this in the future do those instead

2 Likes

can you look at my no clip prevention post and help

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