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

Equip a t-shirt on a NPC?

Asked by 4 years ago

Hi, i have currently scripted my character customisation to simultaneously change pants, shirt, skin colour and hair at the same time, so far i have gotten to change all but pants and shirt and was wondering why this script wouldn't work. Any help is appreciated thanks.

    local NPC = workspace.NPCtoPLAYER 

    NPC:FindFirstChild("Shirt").ShirtTemplate = "rbxassetid://676428254" -- works on character not on npc

thanks

0
Wish I could help but I can't access studio right now, however I would suggest looking for an npc wearing a shirt in free models and try to understand how it works Le_Teapots 913 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You should look into HumanoidDescription, it allows you to change all aspects of any humanoid in one go.

For example what you can do is first get the existing description using:

local description = NPC.Humanoid:GetAppliedDescription()

Then you can alter the description by setting another Shirt and Pants:

description.Shirt = -- shirt id
description.Pants = -- pants id

And lastly you need to re-apply the description:

NPC.Humanoid:ApplyDescription(description)

For more info you can look at the wiki page of the HumanoidDescription system:

https://developer.roblox.com/en-us/articles/humanoiddescription-system

0
worked great thanks :) Samollthecamel -3 — 4y
Ad

Answer this question