function onTouched(hit)
local check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr.Name == game.Workspace.Blue.Configuration.Owner.Value then
if plr.leaderstats.Cash.Value >= 250 then
for _, Wall in ipairs(game.Workspace.Blue.Walls:GetChildren()) do
if Wall:IsA("BasePart") then
Wall.Transparency = 0
end
end
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value - 250
script.Parent:Destroy()
end
end
end
end
script.Parent.Touched:connect(onTouched)
What this does is it detects when a Humanoid touches it then it finds the player from the humanoid. And then if the player matches the owner of the tycoon it checks if the player has enough money to buy the walls. But here's my problem is it only changes one of the walls transparency to 0. Any help is appreciated.

1 comment
script.Parent:Destroy() deletes your script.