TZH on Nostr: random money giving system that multiplies the amount of money given based on the ...
random money giving system that multiplies the amount of money given based on the player's level:
-- Define a function to give money
local function giveMoney()
-- Choose a random amount of money to give (between 1 and 100)
local baseAmount = math.random(1, 100)
-- Multiply the amount of money by the player's level
local levelMultiplier = game.Players.LocalPlayer.leaderstats.Level.Value
local amount = baseAmount * levelMultiplier
-- Update the player's money with the amount
game.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value + amount
-- Print a message to the player with the amount of money received
print("You received " .. amount .. " coins! (Base: " .. baseAmount .. " x Level: " .. levelMultiplier .. ")")
end
-- Call the function every 5 seconds
while true do
wait(5)
giveMoney()
end
Published at
2023-02-09 16:32:09Event JSON
{
"id": "18b93055d5b37b568240158eecbd7433f7b29dd9f727c583f796045374c6cfa3",
"pubkey": "cc7a67745452c600257b3214c78d559d5ef671a9b274827c4bd9ebd7538b8f51",
"created_at": 1675960329,
"kind": 1,
"tags": [],
"content": "random money giving system that multiplies the amount of money given based on the player's level:\n \n-- Define a function to give money\nlocal function giveMoney()\n \n-- Choose a random amount of money to give (between 1 and 100)\n local baseAmount = math.random(1, 100)\n \n-- Multiply the amount of money by the player's level\n local levelMultiplier = game.Players.LocalPlayer.leaderstats.Level.Value\n local amount = baseAmount * levelMultiplier\n \n-- Update the player's money with the amount\ngame.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value + amount\n \n-- Print a message to the player with the amount of money received\n print(\"You received \" .. amount .. \" coins! (Base: \" .. baseAmount .. \" x Level: \" .. levelMultiplier .. \")\")\nend\n\n-- Call the function every 5 seconds\nwhile true do\n wait(5)\n giveMoney()\nend",
"sig": "fb210618dfc5de20b9bf3505b8898473f0f83e6e49ac77e51ff662310819632fd22ad45468e234d1453bd771e3a73f0e66ac6448ebf4527a9166981e82c4c5f3"
}