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

Custom Character Clothes on player spawning?

Asked by
iKeemo 0
8 years ago

Okay, so I already found something similar to this below which gave me a great start, as I'm a newer scripter but the only way to keep me motivated is to work with something that I find is difficult, and I have no clue where to start on this, so basically. I have this.

game.Players.PlayerAdded:connect(function(player)
    local appearanceOverride = game.Players:FindFirstChild(player.Name)
    appearanceOverride.CanLoadCharacterAppearance = false
end)

Now, what I initially planned was to create two teams, SWAT, Criminals, depending on the map and location they'll have different clothes. So, instead of me rambling on about my game, I'll just continue on.

So, my first character I'm working on is going to be a swat person, now that I got it so players appearances won't load, how can I make it so if I made the appearance on a dummy character. Adding the tactical vest model to his torso, and adding textures to his arms, legs, and torso at the same time as his clothing. Along with his helmet. How can I make all of that work for the player when he joins the swat team. Here's a picture of the example (Although no textures are applied right now due to me needing to create em :P)

https://gyazo.com/3f35a055f40acb25c118fc3302268c74

1
Just a tip, put your code between the code block - This makes it easier for us to read. Code block is the button with the two blue circles and Lua written in the larger one. Uroxus 350 — 8y
0
Thank's for the tip xD iKeemo 0 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

Character models have three things inside them - Shirt, Pants and ShirtGraphic (T-Shirts). These are only if the player is wearing one of these items. So:

local shirtId = 00000
local pantsId = 00000

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        if char.Shirt then
            char.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=" ..shirtId -- has to be an image file, remove 1 from the id to get the image. if it's not the shirt, take away 1 again
        else
            local shirt = Instance.new("Shirt",char) -- makes new shirt if the player isn't wearing one
            shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=" ..shirtId
        end
        if char.Pants then
            char.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=" ..pantsId
        else
            local pants = Instance.new("Pants",char)
            pants.PantsTemplate = "http://www.roblox.com/asset/?id=" ..pantsId
        end
    end)
end)
Ad
Log in to vote
0
Answered by
Sxerks3 65
8 years ago
game.Players.PlayerAdded:connect(function(player) -- Hat adder
    repeat wait()until player.Character
    local hatId = 000000 -- Find the ID of the hat
    local hat = game:service("InsertService"):LoadAsset(hatId):GetChildren()[1]
    hat.Parent = player.Character
end)

game.Workspace.ChildAdded:connect(function(plr) --Pants and body adder
    local name = plr.Name
    local playerinplayers = game.Players:FindFirstChild(plr.Name)
     playerinplayers.CanLoadCharacterAppearance = false
     plr.Head.face.Texture = "rbxassetid://000000" --Find an ID of a decal for your face.
     local shirt = Instance.new("Shirt", plr)
     shirt.ShirtTemplate = "rbxassetid://000000" -- Find the ID of the shirt
    local pants = Instance.new("Pants", plr)
    pants.PantsTemplate = "rbxassetid://000000" -- Find the ID of the pants
end)

Answer this question