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

Removing players T-shirt?

Asked by 10 years ago

So, what I need help with is, when a player joins I want it to remove there T-Shirt... here's what I came up with...

Player = game.Players.LocalPlayer

function PlayerCame(Player)
    Player.Character["Shirt Graphic"]:Remove()
end

game.Players.PlayerAdded:connect(PlayerCame)

note I AM new to scripting, so this is just a guess, also, this is in a local script in StarterPack...

2 answers

Log in to vote
1
Answered by 10 years ago

There is also a Decal in the Player's Character's Torso aswell, remove that Decal and the T-Shirt will not show on the Character anymore.

-- Your using both a LocalPlayer kind of script, and a PlayerAdded function, lets change that..
-- Original
Player = game.Players.LocalPlayer
function PlayerCame(Player)
Player.Character["Shirt Graphic"]:Remove()
end
game.Players.PlayerAdded:connect(PlayerCame)
-- New LocalPlayer kind of script
Player = game:service("Players").LocalPlayer
function Joined()
Player.Character:WaitForChild("Shirt Graphic"):remove()
end
Joined()
-- New PlayerAdded function
function PlayerCame(plr)
plr.Character:WaitForChild("Shirt Graphic"):remove()
end
game:service("Players").PlayerAdded:connect(PlayerCame)

I hope this helped!

Ad
Log in to vote
0
Answered by 10 years ago

When using the PlayerAddedeven be sure to use the CharacterAdded event to interact with the player's character. Plus you have to wait for the shirt graphic to load but for some reason my WaitForChild always glitches on me so here you go

script.Parent.Parent.CharacterAdded:connect(function(chr)
    while true do
        local Tee = chr:findFirstChild("Shirt Graphic")
        if Tee then
            Tee:remove()
            break
        else
            wait()
        end
    end
end)

Answer this question