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

How to change brickcolor on touch?

Asked by 5 years ago
Edited 5 years ago

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)
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) User#24146 20 — 5y
0
also you spelt Touched wrong farizarps 132 — 5y
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. User#24146 20 — 5y

1 answer

Log in to vote
0
Answered by
HaveASip 494 Moderation Voter
5 years ago
Edited 5 years ago

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)
Ad

Answer this question