0

# How to Fix It? It Dosen't Change Black

Part = script.Parent

function Touched()
Part.BrickColor = BrickColor.new("Really black")
end



1
Part = script.Parent

function Touched()
Part.BrickColor = BrickColor.new("Really black")
end
Part.Touched:connect(Touched)



You forgot to put the object that connects to the function therefore making an error.

You seem to be new to functions, i suggest checking out http://wiki.roblox.com/index.php?title=Function for more information ^_^

1
Marolex 45
7 years ago

The problem is that you have no event firing the function

Part = script.Parent

Part.Touched:connect(function()
Part.BrickColor = BrickColor.new("Really black")
end)


1
BlueTaslem 18054
7 years ago

To be very clear: There is nothing special about the name Touched.

Your script defines a function, but nothing here causes that function to happen. The game doesn't know about your function yet, because you haven't told it.

You have to tell it about your function by connecting it to an event, probably the touched event:

Part.Touched:connect( Touched )


Note that the second Touched is just the name of your function -- which could be anything. Here, you're saying, "ROBLOX, please remember the function with the named Touched and whenever this event fires, call that function, Touched".

Without that line, nothing happens since there is nothing to cause the function to be called.

-5