#Make it so player cant donate more then what they have in Cash

9 messages · Page 1 of 1 (latest)

light quest
#

No, excatly thats the problem
tonumber(num)

lament aurora
light quest
#

prase the string as number

#

so you can compare it as number

hasty steppe
#

Retrieve the player's current cash value from their leaderstats using the GetPropertyChangedSignal function:

carmine blazeBOT
#

studio** You are now Level 1! **studio

hasty steppe
#

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)