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

Why does the brick doesn't change colors when it goes through a brick?

I been trying to change the brick when it touches the brick, but all it does is nothing. Ex.

function Ontouched(hit)
local found = Workspace:FindFirstChild("Brick1")
if found then 
  found.BrickColor.new(37)
	end
end

or another one Ex.

function Coloring()
	if hit.BrickColor == BrickColor(21) then
	hit.BrickColor = BrickColor.new(37)
	end
end

1 answer

✓ Accepted answer

Well what you're doing is just checking if Brick1 exists, you're not comparing if your hit parameter is Brick1. And your coloring is off on the first script, and you have no connection statements, put this in the part to touch;

script.Parent.Touched:connect(function(hit) --Anonymous function
	if hit.Name == "Brick1" then --check the name
		hit.BrickColor = BrickColor.new() --put the color you want
	end
end)

Hope I helped, have any questions feel free to ask!(:

-Goulstem

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