I want a button that will give Money to everyone in the game. I can code a regular touch button that gives one player stats but I don't know how i can give multiple people money. What would the structure of that Lua script look like? I tried for loops but i'm not fluent in Lua so i messed that up.
local deb = 0
function onTouched(hit)
if deb == 0 then
deb = 1
local check = hit.Parent:FindFirstChild("Humanoid") -- Checking if a player has touched it
if check ~= nil then
local stats = game.Players:findFirstChild():FindFirstChild("leaderstats") -- What do i do here?
if stats ~= nil then
local cash = stats:findFirstChild("Money") -- and here?**
cash.Value = cash.Value + 50
wait(60)
end
end
deb = 0
end
end
script.Parent.Touched:connect(onTouched)
