Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
yurhomi10 192
10 years ago

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

Log in to vote
1
Answered by 10 years ago

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
0
Sweet, thanks bud! yurhomi10 192 — 10y
Ad

Answer this question