Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Clicking an item to give ig money ?

Asked by 4 years ago
Edited by royaltoe 4 years ago

So im working on a game that invovles clicking to get cash in the game but i cant seem to figure out how to connect these scripts

wait()

function scan(p)
    for i=1,#p:children() do
        if p:children()[i]:IsA('BasePart') then
            if (p:children()[i].Size.x + p:children()[i].Size.y + p:children()[i].Size.z) < 25 then
                local c=Instance.new('ClickDetector', p:children()[i])
                    c.MouseClick:connect(function()
                        p.CanCollide = false
                        p.Transparency = 1
                                c:Destroy()
                    end)
                end
            end
        scan(p:children()[i])
    end
end

And

scan(workspace)

script.Parent.MouseClick:Connect(function(player)
    if player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Money") then
            player.leaderstats.Money.Value = player.leaderstats.Money.Value + 500 -- add 1 to money.
    end
end)

can anyone help me figure out this issue Please and thank you

0
Please make the code a codeblock. Lucke0051 165 — 4y
0
Ok i did aj44000 2 — 4y
0
So i'm not quite sure what it is that you're doing (or what the scan function is for) but...You should never allow players to edit their leaderstats via the client, nor do you want to store leaderstats on the client. ForeverBrown 356 — 4y
0

Answer this question