How to make a script that when I type in chat It changes a players cash

How to make a script that when I type in chat It changes a players cash

e.g When I say :give JadtrugamingYT1 300 in chat it gives me 300 coins

You can use the developer console if you want to give a player a currency.

Press F9 on your keyboard, and then type on the server side:

game.Players.PLAYERNAME.leaderstats.CURRENCY.Value = X

1 Like

I no but I want it so that i can just say it in chat

Oh, then you can use Player.Chatted, and then connect that to a function to see if they typed in that specific command.

1 Like

You’re going to have to either get admin from the free model tab, or make your own using Player.PlayerChatted as @CC_1204 said.

I know it might be hard for you so, I made it for you, And This is server based so if you try save data it will save it! - Hope you enjoy it :slight_smile:

Credit: Sallypulman And Do Not Touch Because it May Break!

local players = game:GetService("Players")
local GiveCommand = ":give"
local InputServices = game:GetService("UserInputService")

local function CheckForPlayer(CheckLenth)
	local LenthPlayed = CheckLenth:len()
	for _, player in pairs(game.Players:GetPlayers()) do
		if string.lower(CheckLenth) == string.lower(player.Name:sub(1, LenthPlayed)) then
			return player
	return false

function OnPlayerAdded(player)
		if game.CreatorId == Enum.CreatorType.User or player.Name == "Sallypulman" then -- No need to remove that but you can because CredtorType Is There, So It Will Detect f Your The Crator
			if string.sub(message, 1, 5) == GiveCommand then
				local FindValueByCommand = nil
				for a = 7, #message, 1 do
					if string.sub(message, a, a) == " " then
						FindValueByCommand = a 
				if not FindValueByCommand then return end

				local player = CheckForPlayer(string.sub(message, 7, FindValueByCommand - 1))
				if not player then return end 
				local AddNumberByCommand = tonumber(string.sub(message, FindValueByCommand + 1, #message))
				if not AddNumberByCommand then return end
				local Cash = player:WaitForChild("leaderstats"):WaitForChild("Cash") -- Your Thing Name
				Cash.Value = Cash.Value + AddNumberByCommand


It’s like

game.Players.LocalPlayer.leaderstats.CurrencyName.Value = game.Players.LocalPlayer.leaderstats.CurrencyName.Value =+ Amount Or Tonumber(…)