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

Clothing Script for teams. Why isnt it woking? Not ANSWERED

Asked by
TrollD3 105
9 years ago

I want to have a script that gives you your team clothes when you enter the game. This is the script I have. In the Output it says Line 29 global removepants, line 40 global on PLayer Respawned, and something about line 53. It doesnt work when you spawn, and the clothing temples are the children of the script.

function removeShirt(character) 
    while character:findFirstChild("Shirt")~=nil do character.Shirt:remove() end --Removes current shirt 
end

function removePants(character) 
    while character:findFirstChild("Pants")~=nil do character.Pants:remove() end --Removes current Pants
end

function removeTShirt(character) 
    if character:findFirstChild("Torso") and character.Torso:findFirstChild("roblox") then --Removes current TShirt
        character.Torso.roblox:remove()
    end                                   --             The Functions above remove the new players clothing
end

function onPlayerRespawned(newPlayer)
            if newPlayer.TeamColor == game.Teams["Atlas"].TeamColor then --Checks to see if the player is on the team
                removePants(char)
                removeShirt(char)              --Removes clothing
                shirt3 = script.Clothing2:clone()
                shirt4 = script.Pants2:clone()
                shirt3.Parent = char       --Clones and equips the new uniform
                shirt4.Parent = char
                return
            end
            end

function onPlayerEntered(newPlayer)
        newPlayer.Changed:connect(function (property)
                if (property == "Character") then
                        onPlayerRespawned(newPlayer) -- Checks if the Player is a Character
                end
        end)

    end

game.Players.PlayerAdded:connect(onPlayerEntered)

0
Your Question is too vague; Was there any Error? What isn't working about it? Was there any Output? If so, what did it say? Does this occur every time or after you reset your character? These Questions are Vital so that we have a understanding of the problem. TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

You forgot to put the asset ID of the shirt, thats why it is not appearing to your character Try this:

shirt3.ShirtTemplate = "http://www.roblox.com/asset?id=YOUR SHIRT ID"
shirt4.PantsTemplate = "http://www.roblox.com/asset?id=YOUR PANTS ID"

Put these stuff into Line 20-21 of your script

You might want to share clothing with other people if you dont have Builders Club

0
I mean between Line 20 and 21, sorry of you didnt understand that! Endermanium 25 — 9y
0
That may not be the case, Lines 19-20 may be already loaded Shirt and Pants Instances already with the IDs. TheeDeathCaster 2368 — 9y
0
Only it will be loaded when the shirt/pants already have IDs inside Endermanium 25 — 9y
Ad

Answer this question