Hello, I'm trying to make a part change color when a different part is stepped on. Let's say, when "Part A" is being stepped on "Part B" will change it's color from Ghost grey to Bright yellow. But if you step off "Part A", "Part B" will change back to Ghost Grey. I'm pretty new to scripting, so this is probably very easy. I have no code for "Part A". Here is the code from "Part B".
game.Workspace.Function.OnInvoke = function()
end
script.Parent.Touched:Connect(function()
script.Parent.BrickColor = BrickColor.new("Bright yellow")
end)
script.Parent.TouchEnded:Connect(function()
script.Parent.BrickColor = BrickColor.new("Ghost grey")
end)
script.Parent.Touched:Connect(function()
script.Parent.Material = ("Neon")
end)
script.Parent.TouchEnded:Connect(function()
script.Parent.Material = ("SmoothPlastic")
end)
Could someone please help me?

2 comments
Try reading the touch ended documentery on roblox dev.
isnt this working? it seemms fine? all though why do 2 events? while you can just change the material and the colour with 1 event at the same time so just put the material changing with the color changing in the touched and untouched events