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