Change leaderstats with remote function?

  1. What do you want to achieve?

Hello, I’m trying to make a gambling game with minesweeper style

  1. What is the issue? Include screenshots / videos if possible!

The money collecting part where the player take out the collected money I fire a remote function that takes in the collected amount of money so the exploiter can simply put instead of collected money an amount that they want. I need another way to save the collected money and add it to money
leaderstats

--An example for my script (Local Script)
local TotalMoney = 0

field.Activated:Connect(funtcion()
     TotalMoney += 5
end)

Take.Activated:Connect(function)
     setMoneyFunction:InvokeServer(TotalMoney)
end)
--Server Script
setMoneyFunction.OnServerInvoke = function(player,amount)
	local leaderstats = player:WaitForChild("leaderstats")
	local money = leaderstats:WaitForChild("Money")
	money.Value += math.round(amount)
end

image

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried to find something about firing the remote function on the DevForum but it didn’t help.

What you can do is do this server-side!

You can try creating a function for when a player joins and cloning the gui into the player’s playerGui, and you can check server-side what they are pressing, and it is not exploitable at all!
Let me know if I was right.

Server scripts won’t detect that a button clicked.

For me it worked, can you show me what you have done so i can help you?

You want to see the whole script ? its a little bit complicated but here you go:

I grabbed the whole local script and put it inside a server script
removed the remote function and replaced it with normal functions

I recommend using .MouseButton1Click, which is better, also you should try printing a string everytime you click something

Also, can you show me if there are any errors in output, and if the string you chose is being printed?

EDIT:

instead of script.Parent.OpenMine it should be GUI.OpenMine.

Incorrect. MosueButton1Click can be fired from the server. You should use it just like that

Plus, firing the RemoteFunction from the client can open a door for exploiters.

also, you might get a ban for the game, just saying; be careful :eyes:

2 Likes

Ok guys, I got the answer to my question which is basically I have to do it on Server Script
Thank you so much, but I’ll stop there. @changeno you said that I can get banned for the game. I will be happy if you explain why, Gambling? copyright? so I can be more careful. I just don’t want any problem.

Probably gambling. Make sure to put a disclaimer that it is fake cash in the game’s description aswell as when you join the game to minimize your risk of getting a termination.

Alright, thank you for the tip.

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