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

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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)
Ad
Log in to vote
0
Answered by 4 years ago
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)
0
Sorry i meant “part”, workspace TradingForDom 1 — 4y

Answer this question