Hello! I am currently making a game similar to Tower Of Hell, and I wanted to give myself a certain amount of coins. Just me and some other specific players, not everyone. Can someone help me achieve this? My leaderstat name is Coins, but I also have a Store GUI exactly similar to Tower Of Hell to buy power ups and perks. Can someone help me achieve this?
If I’m understanding correctly you’re looking for a one time change of your coin value? There are two ways to go about this.
-
Assuming you’re in game, you could just open the developer console and select the “Server” section in “Log”. In the command bar you could enter something along the lines of
game.Players.hcpefuls.leaderstats.Coins.Value = 99999
, which would change the amount of coins you have to 99999. Keep in mind this is only a solution if your in game as it’s directly referencing aPlayer
, but it’s the simplest, no code required one. Assuming your data is saved onPlayerRemoving
this should save for the next time you join the game. -
If the player isn’t in game, and your game uses Datastores, you can directly set the value of the datastored value with :SetAsync. I can’t exactly provide 100% working code without knowing what your datastore name and how your saving stuff however that should put you on the right track. There are plugins which do this for you as well, DataStore Editor is one of them
You can script this by checking when the player joins, check if the userid is == to the userids you want to add the coins too, then adding the code to set the coins to the select amount after that. This can also be achieved by using most admin free models, and typing a command every time you join for each person but that is highly unrecommended, and coding it is a better practice.
Doing the same thing but just giving it by adding to the username, similarly to what acazen suggested will work too, but if someone were to change their username it wouldn’t work until the script was changed manually to their updated username, so userid is usually better for player specific actions. It’s also good practice.
If you want to learn more about this, and the player added function I’d recommend reading this.
https://developer.roblox.com/en-us/api-reference/event/Players/PlayerAdded