Skin colour scripts dont work for my custom model

Hello! As of right now i am working on my own game with a custom model which will be fully customizable for the player, but i’m running into some problems already.

  1. What do you want to achieve? I want to have a working skin colour script so players can customize the model with the desired skin colour.

  2. What is the issue? Whenever i use a premade skin colour changer they don’t work entirely on the model. Either everything BUT the head or parts that are unions. (i created certain parts using normal and negative parts, for detail).

What happens when the model enters one of the skin colour blocks.

  1. What solutions have you tried so far? I’ve tried disasembling unions, recolouring parts and then putting them back together but this does not work. I thought that the code could be adjusted to include unions/the specific parts of the model but as i have no coding experience i would not know how.

i want to make this game with the least amount of coding due to my skills but this is a basic i would really want to include…

Here are the assets i used, including their scripts:

First option, works better
Skin color changer - Roblox

bin = script.Parent

function onTouched(part)
	part.BrickColor = script.Parent.BrickColor
	wait(.3)
end

connection = bin.Touched:connect(onTouched)

Second option, works less.
(1) Skin Color Changer (change color of brick for it) - Roblox

function OnTouch(hit)
a = hit.Parent:FindFirstChild("Humanoid")
skiny = hit.Parent:FindFirstChild("Skin")
if (skiny == true) then return end
	local skin = Instance.new("Skin")
	skin.SkinColor = script.Parent.BrickColor
	skin.Parent = hit.Parent
end
script.Parent.Touched:connect(OnTouch)

Credits go to AmiraQueen and Zdude73 for these models!

If there are any alternatives to these codes (like a morph select UI with all skin colours) i’d like to hear them!

thanks in advance! :.)

1 Like
function OnTouch(Hit)
	Humanoid = Hit.Parent:FindFirstChild("Humanoid")
	if Humanoid then 
		for i, Part in pairs(Humanoid.Parent:GetDescendants()) do
			if Part:IsA("BasePart") then
				Part.BrickColor = script.Parent.BrickColor
			end
		end
	end
end
script.Parent.Touched:connect(OnTouch)

Thank you!

For a bit of context where would i need to replace/insert this script in?

you have mentioned this in your post just replace them
also “Skin” Instance is deprecated

I’ve done so… unfortunately it still seems to work like the first option
image

are these parts parented to the character?

Not sure, in what way do you mean?

parented as in mentioned in the script or parented inside the model?

could you show how the model looks like i mean show screenshot of it in explorer

Sure, here is the entirety of the model:


The arms were grouped to avoid confusion since my model posseses posable hands.

These, however, dont seem to affect this issue at all, since these digits are not unions and colour along with the non-unioned parts

would there be a way to adjust the script to include unions and normal parts? logic-wise thatd feel like the easiest option to me

i see some of the parts are meshes

function OnTouch(Hit)
	Humanoid = Hit.Parent:FindFirstChild("Humanoid")
	if Humanoid then 
		for i, Part in pairs(Humanoid.Parent:GetDescendants()) do
			if Part:IsA("BasePart") or Part:IsA("Part") or Part:IsA("MeshPart") then
				Part.BrickColor = script.Parent.BrickColor
			end
		end
	end
end
script.Parent.Touched:connect(OnTouch)

Still the same result… TvT

image

Could a union be directly mentioned in the script or is that something thats needs to be worked around?
Or even specific bodyparts?

i thoughts these are meshes so they were made using Union operations?

1 Like

yeah, using the negate tools i shaped certain parts like the torso and such.

it hasnt given me any isues with the animation and works of the model untill now

1 Like
function OnTouch(Hit)
	Humanoid = Hit.Parent:FindFirstChild("Humanoid")
	if Humanoid then 
		for i, Part in pairs(Humanoid.Parent:GetDescendants()) do
			if Part:IsA("BasePart") or Part:IsA("UnionOperation") then
				Part.BrickColor = script.Parent.BrickColor
			end
		end
	end
end
script.Parent.Touched:connect(OnTouch)

I don’t know if it’s any different but, try his code again but remove the other two conditions:

function OnTouch(Hit)
	Humanoid = Hit.Parent:FindFirstChild("Humanoid")
	if Humanoid then 
		for i, Part in pairs(Humanoid.Parent:GetDescendants()) do
			if Part:IsA("BasePart") then
				Part.BrickColor = script.Parent.BrickColor
			end
		end
	end
end
script.Parent.Touched:connect(OnTouch)

Both Parts and MeshParts are BaseParts, so you need not to include those other two conditions.

i was confused because pervious code didnt work now turns out these are Unions

yeah… i did try to specify this as much as i could in the initial question…

i dont remember if unions color could be changed

i saw a video about it and it should be possible… i could try to look at that

function OnTouch(Hit)
	Humanoid = Hit.Parent:FindFirstChild("Humanoid")
	if Humanoid then 
		for i, Part in pairs(Humanoid.Parent:GetDescendants()) do
			if Part:IsA("UnionOperation") then
				Part.UsePartColor = true -- or just set this property manually to the parts and use the first code i had sent
				Part.BrickColor = script.Parent.BrickColor
			elseif Part:IsA("BasePart")  then
				Part.BrickColor = script.Parent.BrickColor
			end
		end
	end
end
script.Parent.Touched:connect(OnTouch)