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

Any ways of equipping assets unto Player?

Asked by
Serpawh -4
5 years ago

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.

0
So you want all characters to wear same shirt and pants? memguy 161 — 5y
0
Yes. Please. Serpawh -4 — 5y
0
Do you want every character to be identical or only wear the same clothing? alphawolvess 1784 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago
game.Players.PlayerAdded:Connect(function(plr)

    local char = plr.Character
    local shirt = Instance.new('Shirt')
    local pants = Instance.new('Pants')

    shirtID = -- Put your shirt ID here
    pantsID = -- Put your pants ID here

    shirt.ShirtTemplate = 'rblxasset://'..shirtID
    pants.PantsTemplate = 'rblxasset://'..pantsID

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

Ad
Log in to vote
1
Answered by 5 years ago

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.

game:GetService("Players").PlayerAdded:Connect(function(Plr)
    Plr.CharacterAdded:Connect(function(Char)
        local Hum = Char:WaitForChild("Humanoid")
        local HumDescClone = Hum:GetAppliedDescription() -- Gets current character assets

        HumDescClone.Shirt = "2976901625"
        HumDescClone.Pants = "2968835127"

        repeat wait() until Char.Parent == game.Workspace -- If the char is not in Workspace, you'll recieved a DataModel error for the below line!

        Char.Humanoid:ApplyDescription(HumDescClone)
    end)
end)
0
You can also use the above to change bodyparts, and add hats, etc alphawolvess 1784 — 5y

Answer this question