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)
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
script.Parent.Touched:Connect(function(touch)
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
wait(2)
debounce = false
end
end
end)