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

Why isn't my PlayerAdded clothing not working?

Asked by
Jurdy 0
10 years ago

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!

0
It only works in solo player Jurdy 0 — 10y
0
Bump Jurdy 0 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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
Ad

Answer this question