Deleted Post - Deleted Post - Deleted Post

Deleted Post - Deleted Post - Deleted Post

I help vastly if you answer the questions provided in this post. Because your current post is lacking of much background information which makes it hard to understand what you want.

What are you asking for? Do you already have some code written?

Okay, please post your script so we can help you.

Can you put it in codeblocks by wrapping it in 3 backticks at the beginning and end?

-- this is a codeblock
1 Like

First of all, sending a value to be increased or decreased from the client to the server is not the best idea because exploiters can manipulate them.
Paste this in your local script:

local tool = script.Parent
local player = game.Players.LocalPlayer
local Debounce = false

tool.Activated:Connect(function()
if Debounce == false then
Debounce = true
game.ReplicatedStorage.FilteringFunction:InvokeServer()
wait(.5)
Debounce = false
end
end)

and paste this in your server script:

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local RemoteEvents = ReplicatedStorage.RemoteEvents
local FilteringFunction = ReplicatedStorage.FilteringFunction

FilteringFunction.OnServerInvoke = function(Player)
local value = 500
Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value + value
end
3 Likes

Backticks are `, what you did was quoting. The first parameter for the .OnServerInvoke callback is the player who fired the remote so there is no reason to pass the player as an argument. As well, you are not returning anything in the callback function. If you do not need to send anything back to the client, you do not need to use RemoteFunctions, you can just use RemoteEvents. Also, you can just do Player.leaderstats.Coins.Value += value instead of rewriting the path. Also, there is no reason for you to define the value variable and send it to the server if it is already going to be constant. You can just do += 500 on the server.

i solved it myself by searching on hub