#Make it so player cant donate more then what they have in Cash
9 messages · Page 1 of 1 (latest)
What should I do
Retrieve the player's current cash value from their leaderstats using the GetPropertyChangedSignal function:
** You are now Level 1! **
Modify the "/pay" command to check if the specified amount is less than or equal to the current cash value:
local function onPlayerChatted(message)
if message:sub(1, 5) == "/pay " then
local amount = tonumber(message:sub(6))
if amount and amount <= cash.Value then
-- Subtract the amount from the current cash value and clone the object here
else
-- Display an error message to the player
end
end
end
player.Chatted:Connect(onPlayerChatted)
local function onPlayerChatted(message)
if message:sub(1, 5) == "/pay " then
local amount = tonumber(message:sub(6))
if amount and amount <= cash.Value then
-- Subtract the amount from the current cash value and clone the object here
else
-- Display an error message to the player
end
end
end
player.Chatted:Connect(onPlayerChatted)