Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Whats wrong with this LocalScript?

--[iLegimate]--

Player = game.Players.LocalPlayer


BodyParts = Player:GetChildren()

for i,b in pairs("BodyParts") do
if (b.className == "CharacterMesh") or (b.className == "Shirt") or (b.className == "Pants") or (b.className == "ShirtGraphic") then
b:Remove()
else
	return nil
		end
	end

I tried that but its saying :

19:16:43.290 - Script 'Players.Player.Backpack.PlayerConfiguration', Line 8 19:16:43.291 - Stack End

#1 bad arguments to 'pairs' (table expected,got string)

Can anyone help,Im basically trying to do,Once the player's character has loaded,It runs the scrpt and if it finds any packages,shirts,pants or t-shirts then it removes them.

1 answer

✓ Accepted answer
-- The problem is the script seen the " and started to run the table as a string, but you need it to run a table so all you need to do is remove the "
Player = game.Players.LocalPlayer


BodyParts = Player:GetChildren()

for i,b in pairs(BodyParts) do
if b.className == "CharacterMesh" or b.className == "Shirt" or b.className == "Pants" or b.className == "ShirtGraphic" then
b:remove()
else
end
    end

3 comments

0

This script will also need to be in StarterGui or Starterpack in order to run correctly.

0

Startergui = Playergui and Starterpack = Backpack if you didnt know. ;D

0

Ty

This discussion is preserved as it was. New answers, comments, and votes are closed.