I have been trying to script an outfit system where there are sets of outfits the player can choose from. The ID’s of each accessory, shirts, and pants are stored for each outfit in a module script. But I am unable to figure out how to go about it myself. I have tried using "HumanoidDescriptions" but I can’t seem to understand how it works.
I also need it so that it ignores an accessory slot if it is stated as nil within the module (there are 3 slots for 3 accessory types for each outfit).
Hi, I believe I know a fairly simple solution to this problem although it may require you to change your approach to this idea.
Roblox provides shirt and pants instances already, so what you could do is loop through all the instances in the player’s character and when you find the shirt and pants, just change the IDs to the ones you have saved in your module script.
I am not 100% sure that this solution will work since I am not sure if the instances allow you to change the IDs while the game is running, in the event that it does not you could also try deleting the already existing instances and replace them with the ones that have your desired IDs.
This is more of a suggestion than a solution, but I think it could work, let me know if it does not.
Well, the script in that template does it, and if you don’t understand that code, you should do something more basic. I recommend going to roblox dev documentation and start there, maybe do the tutorials and do basic things first. Roblox does an amazing job at explaining things and if anyone can do it better than them, it isn’t someone here on the fourms, trust me.
I thought I saw something once before which used InsertService to load accessories onto the character. I’m not entirely sure how well this works, but you can try it for yourself.
local InsertService = game:GetService("InsertService")
local char = game.Players.LocalPlayer.Character
InsertService:LoadAsset(id).Parent = char -- id is the asset id
Also for pants/shirts, I’m pretty sure you can just change the shirt and pant template IDs (a property of shirt and pant instances under the character)