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

Why isn't my PlayerAdded clothing not working?

I tried making a script where a person enters the game he receives certain clothing. It seems to work in solo but not the actual game....

char = game.Players

game.Players.PlayerAdded:connect(function(p)
    repeat wait() until p.Character -- Wait for a character
    if not char:FindFirstChild("Shirt") then -- If they don't have a shirt object give them one
        Instance.new("Shirt",char).Name = "Shirt"
    end
    if not char:FindFirstChild("Pants") then -- If they don't have a pants object give them one
        Instance.new("Pants",char).Name = "Pants"
    end
    p.Character:WaitForChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=179631998"
    p.Character:WaitForChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=179650451"
end)

--Thanks buddy for helping!

Please help!

2 comments

0

It only works in solo player

0

Bump

1 answer

I've had the same problem. It's an easy fix. Just add the shirt and pants into lighting and clone them. Then, change it. Also, even if your script worked, it wouldn't show up for other players, they would see your default clothing. Make sure it is a server script inside of workspace.

--char = game.Players <-- what?

game.Players.PlayerAdded:connect(function(p)
    repeat wait() until p.Character 
    char = p.Character
    if not char:FindFirstChild("Shirt") then 
        Instance.new("Shirt",char).Name = "Shirt"
    end
    if not char:FindFirstChild("Pants") then 
        Instance.new("Pants",char).Name = "Pants"
    end
    shrt = game.Lighting:WaitForChild('Shirt'):Clone()
    shrt.ShirtTemplate = "http://www.roblox.com/asset/?id=179631998"
    shrt.Parent = char
    pnts = game.Lighting:WaitForChild('Pants'):Clone()
    pnts.PantsTemplate = "http://www.roblox.com/asset/?id=179650451"
    pnts.Parent = char

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