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

[Fixed] This script doesn't apply clothes to a player. Someone help?

Asked by
MediaHQ 53
3 years ago
Edited 3 years ago
local plrs = game:GetService("Players")

plrs.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        local folder = script:FindFirstChild(p.Team.Name)
        if folder then
            local tools = folder:FindFirstChild("Tools")
            if tools then
                for i,v in pairs(tools:GetChildren()) do
                    v:Clone().Parent = p.Backpack
                end
            end
            local clothes = folder:FindFirstChild("Clothes")
            if clothes then
                local shirt = c:WaitForChild("Shirt")
                local pants = c:WaitForChild("Pants")
                shirt.ShirtTemplate = clothes.Shirt.Value
                pants.PantsTemplate = clothes.Pants.Value
            end
        end
    end)
end)

What the script does is it basically gets the players team and if it finds a folder of the players team then it applies tools and clothes. But for some reason It doesn't apply clothes. Nothing prints in the console and I use StringValues to apply templates to the user's original clothes.

Fixed: I put the wrong id in for the shirt and pants

Answer this question