local cash = script.Parent.Parent.Parent.Parent.leaderstats:WaitForChild(“Subscribers”)
The leaderboard stat here is “Subscribers” and I’m planning on having an NPC kill give 1 subscriber when killed by a player. But I’m confused and I don’t know how to script it so it would reward you a subscriber when dead.
Since the server is authorizing the damage and replication of damage for all clients. If it’s a simple NPC and assuming you aren’t doing any AI configurations on it, I suggest just keeping a table of all the current NPC’s in game that has values containing what you need (don’t go overboard because the more you store the more mem. usage, although negligible in some cases just don’t go down that hole). For your case I don’t necessarily think what I stated above is needed since you can just alter and reward the player on the remote call it makes to damage and replicate it’s damage to the NPC. However, for a simple rewarding system that rewards all clients that contributed to “killing” the NPC you can keep a list in that table I mentioned of all clients that have attacked and clear the list of all clients that haven’t attacked for a given time span (all configurable). Hope that helped answer your problem!