You would just give the coin when you damage the boss/NPC.
And here is a simple script that would increase the player currency.
local currencyName = "Coin"
local coinsPerHit = 2 -- 2 coins would be given when hit the boss/NPC
local plr = nil -- i am not gonna define the player since i dont know what script you are gonna put it into.
plr.leaderstats[currencyName].Value = plr.leaderstats[currencyName].Value + coinsPerHit
No, If you are using Table to store player’s name and money You just use table.insert().
but If You are using Folder to Store player’s name and money. You just add a string value that tell player’s name and player’s money that they get from boss.
alr this helped me a lot but how will I make for the hits? Like each time you hit the boss wich i think you would do an onTouched event I want to add 1 to hits
for the hits would I need to add 1 to hits each time a touch event is triggered with the sword. But how will I implement this on other players with a gamepass x2 coins? this is harder than what I thought xD