I wrote a local script that is inside a startergui. This script is going to check if the player has a tool or any "towers" with a specific name and add them up. But when i add them up and got the sum it was 0 even though i got the tools and towers placed help?
function TowerCount() local zombies = {} local c = game.Workspace:GetChildren() for index, child in pairs(c) do if child.Name == "Turret-Archer "..game.Players.LocalPlayer.Name and child.Name == "Turret-Mage "..game.Players.LocalPlayer.Name then table.insert(zombies, child) end end return #zombies end function TowerInve() local zombies = {} local c = game.Players.LocalPlayer.Backpack:GetChildren() for index, child in pairs(c) do if child.Name == "Summon Archer" and child.Name == "Summon Mage" then table.insert(zombies, child) end end return #zombies end while wait() do print(TowerCount() + TowerInve()) -- print out sum end
if child.Name == "Turret-Archer "..game.Players.LocalPlayer.Name and child.Name == "Turret-Mage "..game.Players.LocalPlayer.Name then table.insert(zombies, child) end -- It can't be "Turret-Archer..." AND "Turret-Mage", I'd suggest converting it to OR instead...
I don't see any problems here have you opened output?