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

How to change brickcolor on touch?

I am trying to make a part change color if player touches it, but it won't work. I am new scripter so can someone describe me about how will this script work?

part.Tocuehd:connect(function(hit)
    humanoid=hit.Parent:FindFirstChild("Humanoid")
    if humanoid ~=nil then
        game.Workspace.carpet.BrickColor=BrickColor.Color3.new(117,0,0)
    end
end)

3 comments

0

1.In your first line part is unknown the script cant know what does the part mean, so use script.Parent.Touched:connect(function(hit)

0

also you spelt Touched wrong

0

2.Also you wrote the Touched event wrong (you wrote"Tocuehd",your must write"Touched").The script is very sensetive your script should be very clear so the script can read it.

1 answer

For first use "Connect" cuz "connect" is deprecated. You have many errors in your script.

part.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		game.Workspace.carpet.BrickColor = BrickColor.new("Really red") --changing color to red
	end
end)

Here is colors that you can use for brickcolor.

one more bouns thing. If you want to convert some brickcolor to Color3(RGB) just type this code:

BrickColor = BrickColor.new("Really red").Color

You can use that like this:

local BrickToColor = BrickColor.new("Really red").Color

script.Parent.Color = Color3.new(BrickToColor)

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