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

Shirt & Pants not being added to the character when I call it? [Un-Answered]

Asked by
saucyP 7
7 years ago
Edited 7 years ago

I have made 2 scripts where they change a person's clothing to their according shirt, the only difference between the two is that one is for the Blue team and the other is for the Red team. I have placed both scripts in the StarterPack, and when I run the game, the script doesn't work, even though there are no output errors. Here's the code:

local player = script.Parent.Parent
function changed(prop)
    if (prop == "TeamColor") then
        if player.TeamColor == BrickColor.new("Bright blue") then
        local p = player.Character; 
        -- the ifs
        if p:FindFirstChild("Shirt") then -- same as ~= nil
            p.Shirt:Destroy()
        end
        if p:FindFirstChild("Pants") then
            p.Pants:Destroy()
        end

        -- adding the shirt & pants
        a = Instance.new("Shirt")
        a.ShirtTemplate = ("http://www.roblox.com/asset/?id=13997673")
        a.Parent = p

        b = Instance.new("Pants")
        b.PantsTemplate = ("http://www.roblox.com/asset/?id=31728834")
        b.Parent = p
        end
    end
end

player.Changed:connect(changed)
0
In the other script, line 04 has BrickColor.new("Bright red") and line 16 has the red shirt. The pants stay the same for both teams. saucyP 7 — 7y

Answer this question