How do i make my player get cash when a NPC dose something?

so I have made the code and the NPC does what it needs to but my player has a tool that he uses to make the NPC do something else, how do I make it so when the NPC does the thing my player gets the cash? I know how to add a but I don’t know how to find the player’s cash value to add it. all i really need is to be able to find the player who has the tool and used it, how can i find the value of that one player?

player.leaderstats.Cash.value = player.leaderstats.Cash.value +

editor: you say check player’s tool?

1 Like

yes but what is player? if i just type player it will error cuz i dont have a player value set and dont know how to set one

It’s player instance

1 Like

so i can just do player and it will get the local player that used the tool?

Are you using localscript? then script should use remoteevent

1 Like

i need only the player who used the tool to get the cash but i think i just got a idea, i am using clones so what if i make the clone the name of the player? then i can easly know witch is witch, is that right?

What do you mean by a tool? Is it a Tool instance?

i use a server script to get a clone and a local script for other stuff inside the tool

thanks for the help ill fix it myself, thanks for your help

ok but be careful. You can’t change cash with a local script, use remoteevent.

1 Like