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

How to remove stuff in the banned list from a player?

Basically, I want to remove hats, tshirts and whatever else that allows the player to be customized or different from others.

banned = {"T-shirt", "Shirt", "Pants", "Hat"}


game.Players.PlayerAdded:connect(function(player)
	--[[local Stats = Instance.new("Model" ,player)
	Stats.Name = "leaderstats"
	local SPoints = Instance.new("IntValue",Stats)
	SPoints.Name = "Points"]] -- dont worry about this :p
	
	parts = player.Character:GetChildren()
	
	for _, p in pairs(parts) do
		-- dunno what to do here...
	end
	
end)

1 answer

✓ Accepted answer

A T-Shirt object is actually called a ShirtGraphic

Inside your PlayerAdded event, use the following:

player.CharacterAdded:connect(function(char) --We use the CharacterAdded event so we remove it every time the player spawns
	local parts = char:GetChildren()
	for _, p in pairs(parts) do
		for _, b in pairs(banned) do
			if p:IsA(b) then
				p:Destroy()
			end
		end
	end
end

1 comment

0

Sweet, thanks bud!

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