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 5 years ago
Edited by royaltoe 5 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

01wait()
02 
03function scan(p)
04    for i=1,#p:children() do
05        if p:children()[i]:IsA('BasePart') then
06            if (p:children()[i].Size.x + p:children()[i].Size.y + p:children()[i].Size.z) < 25 then
07                local c=Instance.new('ClickDetector', p:children()[i])
08                    c.MouseClick:connect(function()
09                        p.CanCollide = false
10                        p.Transparency = 1
11                                c:Destroy()
12                    end)
13                end
14            end
15        scan(p:children()[i])
16    end
17end

And

1scan(workspace)
2 
3script.Parent.MouseClick:Connect(function(player)
4    if player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Money") then
5            player.leaderstats.Money.Value = player.leaderstats.Money.Value + 500 -- add 1 to money.
6    end
7end)

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

0
Please make the code a codeblock. Lucke0051 165 — 5y
0
Ok i did aj44000 2 — 5y
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 — 5y
0

Answer this question