I want to figure out how to make a script that has a brick change color when it is touched by another object. I know how to do it when a character touches it, but I'm not sure what I need to change to have it happen for another object.
script.Parent.Touched:connect(function() script.Parent.BrickColor = BrickColor.new("Cyan") wait(2) script.Parent.BrickColor = BrickColor.new("Medium stone grey")
end)
This is what I have for changing it when a character touches it
Both of these scripts both work, but you can choose. This code below only activates if it detects a Humanoid.
script.Parent.Touched:Connect(function(plr) local Humanoid = plr.Parent:FindFirstChildWhichIsA("Humanoid") if Humanoid then script.Parent.BrickColor = BrickColor.Random() end end)
However this script is slightly different, instead of just the Humanoid being able to touch it anything can. Like a baseplate for an example.
script.Parent.Touched:Connect(function() script.Parent.BrickColor = BrickColor.Random() end)
Hope this helps!
REQUEST
script.Parent.Touched:Connect(function(Touched) if Touched.Parent.Name == "Blah" then -- In blah put your part name. script.Parent.BrickColor = BrickColor.Random() end end) -- Put a script in a part and create a tool or whatever you're using to change the color. -- Put the tool name exactly as what Blah or what you put there says. -- Put a part in the tool named Handle.