-- Variables
local player = game.Players.LocalPlayer -- Reference to the local player
local cashAmount = 100 -- Amount of cash to award
-- GUI Setup (if you want this to be triggered by a button click)
local screenGui = Instance.new("ScreenGui", player.PlayerGui) -- Add a GUI to the player
local button = Instance.new("TextButton", screenGui) -- Create a button
-- Button Properties
button.Text = "Get Cash"
button.Size = UDim2.new(0, 200, 0, 50) -- Width: 200px, Height: 50px
button.Position = UDim2.new(0.5, -100, 0.5, -25) -- Centered on the screen
button.BackgroundColor3 = Color3.fromRGB(0, 255, 0) -- Green button
-- Function to award cash
local function awardCash()
-- Create a "leaderstats" folder if not already present
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then
leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
end
-- Add "Cash" if it doesn't already exist
local cash = leaderstats:FindFirstChild("Cash")
if not cash then
cash = Instance.new("IntValue", leaderstats)
cash.Name = "Cash"
cash.Value = 0 -- Initialize cash at 0
end
-- Increment cash
cash.Value = cash.Value + cashAmount
print(player.Name .. " now has " .. cash.Value .. " cash!")
end
-- Connect the button click to the function
button.MouseButton1Click:Connect(awardCash)
No script available.
No comments yet.
© RoScripts 2024 All Rights Reserved.