I am wondering if there is any possibility of me making a character wear some shirt/pant. I know this might be harder than it looks, but if someone could help me I'd appreciate it a lot.
So far my scripting is limited to Humanoid, and everything beginner.
01 | game.Players.PlayerAdded:Connect( function (plr) |
02 |
03 | local char = plr.Character |
04 | local shirt = Instance.new( 'Shirt' ) |
05 | local pants = Instance.new( 'Pants' ) |
06 |
07 | shirtID = -- Put your shirt ID here |
08 | pantsID = -- Put your pants ID here |
09 |
10 | shirt.ShirtTemplate = 'rblxasset://' ..shirtID |
11 | pants.PantsTemplate = 'rblxasset://' ..pantsID |
12 |
13 | end |
If this doesn't work, just add an R15/R6 rig, add the shirt/pants to it, then name the model 'StarterCharacter' then put it in game.StarterPlayer. Hope this helps! <3
There are several ways to accomplish what you want, such as the Answer by Cvllapse. However, a newer method has been released not too long ago using HumanoidDescription
. Bellow is the script that should accomplish your task, of course, don't forget to change the shirt/pants to your desired ID.
01 | game:GetService( "Players" ).PlayerAdded:Connect( function (Plr) |
02 | Plr.CharacterAdded:Connect( function (Char) |
03 | local Hum = Char:WaitForChild( "Humanoid" ) |
04 | local HumDescClone = Hum:GetAppliedDescription() -- Gets current character assets |
05 |
06 | HumDescClone.Shirt = "2976901625" |
07 | HumDescClone.Pants = "2968835127" |
08 |
09 | repeat wait() until Char.Parent = = game.Workspace -- If the char is not in Workspace, you'll recieved a DataModel error for the below line! |
10 |
11 | Char.Humanoid:ApplyDescription(HumDescClone) |
12 | end ) |
13 | end ) |