Need help with a currency giver UI

I’m trying to create a GUI for the developers of my game to make it easier for them to give people money. I want people to be able to enter a name and then the amount they want to give and then press a button to give the money.

The GUI is already done and I don’t need a whitelist system because I know how to do it. The fields where you put the amount of the cash and the player’s name are a TextBox.
And I got no idea how to script make such a system.

Try this
On client side:

local replicated = game:GetService("ReplicatedStorage")
local remote = replicated:WaitForChild("GiveMoney")

local guiButton = script.Parent-- change to your path
local input =  script.Parent.moneyInput -- change to your path
local playerNameInput = script.Parent.playerInput -- change to your path

guiButton.MouseButton1Click:Connect(function()
	if tonumber(input.Text) then
		remote:FireServer(playerNameInput.Text,tonumber(input.Text))
	end
end)

On server side:

local replicated = game.ReplicatedStorage
local remote = replicated.GiveMoney
local players = game.Players

remote.OnServerEvent:Connect(function(Player,target,amount)
	if typeof(target) ~= "string" then return end
	if not tonumber(amount) then return end
	local foundPlayer = players:FindFirstChild(target)
	if foundPlayer then
		foundPlayer.leaderstats.Cash.Value += tonumber(amount)
	end
end)
1 Like

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