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
9 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.

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

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 — 9y
0
Thank's for the tip xD iKeemo 0 — 9y

2 answers

Log in to vote
0
Answered by 9 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:

01local shirtId = 00000
02local pantsId = 00000
03 
04game.Players.PlayerAdded:connect(function(p)
05    p.CharacterAdded:connect(function(char)
06        if char.Shirt then
07            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
08        else
09            local shirt = Instance.new("Shirt",char) -- makes new shirt if the player isn't wearing one
10            shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=" ..shirtId
11        end
12        if char.Pants then
13            char.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=" ..pantsId
14        else
15            local pants = Instance.new("Pants",char)
16            pants.PantsTemplate = "http://www.roblox.com/asset/?id=" ..pantsId
17        end
18    end)
19end)
Ad
Log in to vote
0
Answered by
Sxerks3 65
9 years ago
01game.Players.PlayerAdded:connect(function(player) -- Hat adder
02    repeat wait()until player.Character
03    local hatId = 000000 -- Find the ID of the hat
04    local hat = game:service("InsertService"):LoadAsset(hatId):GetChildren()[1]
05    hat.Parent = player.Character
06end)
07 
08game.Workspace.ChildAdded:connect(function(plr) --Pants and body adder
09    local name = plr.Name
10    local playerinplayers = game.Players:FindFirstChild(plr.Name)
11     playerinplayers.CanLoadCharacterAppearance = false
12     plr.Head.face.Texture = "rbxassetid://000000" --Find an ID of a decal for your face.
13     local shirt = Instance.new("Shirt", plr)
14     shirt.ShirtTemplate = "rbxassetid://000000" -- Find the ID of the shirt
15    local pants = Instance.new("Pants", plr)
16    pants.PantsTemplate = "rbxassetid://000000" -- Find the ID of the pants
17end)

Answer this question