Hit a part for currency

So I want to make a system when you hit a part with a specific tool it gives you currency, but I’m new to programming and don’t know how to do that.
I already created the currency script

And I tried to create a script that gives you money when you hit it but it says that Fire Server Can Only Be Called By Client (I tried to use a local script, but nothing happens when i use it, even the error message in the output)

The script:

Well uhh, I’m not sure because I didn’t tested this script alright put a script inside your part and write the following code :

local debounce = false

    if touch.Parent.Name == "Spanner" then
        if debounce == false then
            debounce = true
            local player = game.Players:GetPlayerFromCharacter(touch.Parent.Parent)
            player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 10
            debounce = false
1 Like

It workeds, but I fixed something, btw you give me the way, thanks very much :slight_smile:

1 Like