Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I change a part to a player's head color when they touch it?

Hello I've been trying to get some of my script to change the color of a part when touched to the player's head color but with no luck, if I can please get some help with this it would be very much appreciated.

I don't really have a lot of the code except the touch part but I can't make it to change the color to the player's head color.

2 answers

✓ Accepted answer

Well, speaking generally, there's nothing too difficult, you can utilize a BasePart's "Touched" event in order to detect when it is touched, then, simply check for and grab the head's (if it is there) color, then apply it to the part.

A very simple example would be this:

local part = Instance.new("Part", workspace);

part.Touched:Connect(function(object)
	if object.Parent:FindFirstChild("Head") then
		part.Color = object.Parent.Head.Color;
	end
end)
local part = Instance.new(“workspace”, Part)

part.Touched:Connect(function(object)
local object = object.Parent
local findHead = object:findFirstChild(“Head”)
findHead.Color = Color3.new(your color code here)

1 comment

0

Sorry i meant “part”, workspace

This discussion is preserved as it was. New answers, comments, and votes are closed.