I don't know why CashPiles is underlined in red
local moneyData = script.Parent:GetChildren()
if CashPiles.Name == "Stack" then
cashpiles:FindFirstChild('Cash').Touched:connect(function(hit)
if hit.Parent then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
if cashpiles:FindFirstChild('Cash').Transparency == 0 then
plr.Wallet.Value = 5000
local parts = cashpiles:GetChildren()
for p = 1, #parts do
if parts[p]:IsA('Part') then
if parts[p]:FindFirstChild('Texture') then
parts[p]:FindFirstChild('Texture').Transparency = 1
end
parts[p].Transparency = 1
parts[p].CanCollide = false
end
end
end
end
end
end)
end
