TZH on Nostr: Random give money -- Define a function to give money local function giveMoney() -- ...
Random give money
-- Define a function to give money
local function giveMoney()
-- Choose a random amount of money to give (between 1 and 100)
local amount = math.random(1, 100)
-- 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!")
end
-- Call the function every 5 seconds
while true do
wait(5)
giveMoney()
end
Published at
2023-02-09 16:25:21Event JSON
{
"id": "a9a39da01cd9790ae8a9527cb045b8a2c99aa0156142c0d4c07b3fbb226208cd",
"pubkey": "cc7a67745452c600257b3214c78d559d5ef671a9b274827c4bd9ebd7538b8f51",
"created_at": 1675959921,
"kind": 1,
"tags": [],
"content": "Random give money \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 amount = math.random(1, 100)\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!\")\nend\n\n-- Call the function every 5 seconds\nwhile true do\n wait(5)\n giveMoney()\nend",
"sig": "4759aeecda3fbb88c4fee934925214ab0915b0323c45ee58db9fb677382ce86afeee69feeb54c09206b111693814ff6c0ec3384c2ac2d52a70686857aaf40616"
}