Character Customization - Color Individual Parts?

I will warn I’m not very good with Luascript. However I was able to get pretty far by following tutorials alone. Unfortunately, some tutorials don’t cover every subject.
I recently followed a tutorial that allowed me to set a body part to a color using GUIs.
For example, clicking this red button will turn your head red: image
The problem is that the body part that is colored is predetermined, and I don’t want to make entire section for each and every body part for a custom model that has as over 40 parts, and that’s not including unadded accessories.

I’m wondering if there’s a way for the player to select the body part(s) they’d like on one tab, and then select the color they’d like on the other. I’ve seen it applied that way in Warrior Cats: Uncharted Territory, but never understood how to make something like that. Thanks in advance for any help.

1 Like

I’m not sure if this is the best way to do it, but you could try detecting when a player selects something, adding a tag to the “body part” that’s related to the setting/button, and when the player clicks the color, do a for loop to color all of them.

Something like this:

local CollectionService = game:GetService("CollectionService")

LeftLegButton.MouseButton1Click:Connect(function()----when they press the body part button
	if Character.LeftLeg:HasTag("SelectedParts") then----Detect if its already selected
		CollectionService:RemoveTag(Character.LeftLeg, "SelectedParts")---if so, deselect it
		---also deselect the button however you want (just decoration like removing a highlight)
	else
		CollectionService:AddTag(Character.LeftLeg, "SelectedParts")---if not, select it
		---also select the button however you want (just decoration like highlighting)
	end
end)

ColorButton.MouseButton1Click:Connect(function()------------Whatever function you use to color the parts
	for i, BodyPart in pairs(CollectionService:GetTagged("SelectedParts")) do----Do this for all selected parts
		BodyPart.Color = Color3.fromRGB()---Color here
	end
end

1 Like

This is what I have so far (sorry for late reply i was sleeping + sorry for messy scripting)

I am a bit stuck because the game doesn’t know how to identify “Character”. I was able to identify “Character” in my “Animate” script but only by putting said script in the morph’s model and identifying it as the parent:


However, the scripts for the GUI are stored in the buttons (see first image) so I honestly don’t know how to make the script find the model after the player’s morphed into it. (I was originally going to change the morphing process from touching a proximity prompt ingame to just clicking the play button, but I hadn’t gotten that far lol)

How stuff looks ingame if you’re confused about where I’m at:

In attempt to fix it I made it worse :sob: good lord
quick clip, too big for devforum though, check it here: https://www.youtube.com/watch?v=kvsUuT5G5-Y
I moved the script over to a normal script rather than a local script and it did not help :smiling_face_with_tear:

I’m completely lost, here’s my scripts so far.





image

I fixed this, the thing is that all of the local scripts inside the GUI merely send out signals to RemoteEvents

Or I thought I did…
I fixed the morph button, but then after trying to implement the body part selection and colors, now nothing works. Lovely.

Edit: After a few changes at the bottom, morphing works again. Selecting and coloring? Does not.
Edit: IT IS FIXED

FINAL POST ON SUBJECT CONTAINING EDITED SOLUTION
Since my script functioned by using GUI text buttons to fire events into replicatedstorage and by editing a custom character rather than the normal avatar, which is why I had so much issues with this. After making multiple adjustments, this is the final script. I couldn’t have done it without you, so thank you so much!


oh sorry I just got back on the forums, I’m glad you could figure it out!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.