HD admin custom leaderstat command

I am using HD admin and I’m trying to make a custom command where I (the owner) can give or take an amount of currency from a player. This is what I have now, I am not fimiliar with this stuff so some help would be appreciated!

	{
	Name = "give";
	Aliases	= {};
	Prefixes = {settings.Prefix};
	Rank = 5;
	RankLock = false;
	Loopable = false;
	Tags = {"Abusive"};
	Description = "give tokens to players";
	Contributors = {};
	--
	Args = {"Player", "Stat", "Amount"};
	Function = function(speaker, args)
			local plr = args[1]
			local stat = args[2]
			local amt = args[3]
			
			game.Players:WaitForChild(plr).leaderstats:WaitForChild(stat).Value += amt
			
	end;
	UnFunction = function(speaker, args)
		
	end;
	--
	};
2 Likes

There is already a built in command for this I believe:

This one adds a certain amount of the provided stat to the provided player:

:add

This one substracts a certain amount of the provided stat to the provided player:

:subtract

This one sets a certain amount of the provided stat to the provided player:

:change

2 Likes

Bro thanks so much i spent a while on this for nothing lol!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.