I'm trying to make a script where a brick connected under the train hits a single brick (not grouped whatsoever) on the track named "TripCock", it'll turn the vehicleseat in the train the color red.

When ever the brick on the track comes into contact with the brick under the train, the seat stays the same color and does not change.

function onTouched(touch)
	if touch.Parent.Name == "TripCock" then
			script.Parent.Parent.Parent.Parent.Parent.R46ACar.Body.Part.BrickColor = BrickColor.Red()
	
		end
	end
script.Parent.Touched:connect(onTouched)

Note: All the "parents" in the script are correct, also "part" is the vehicleseat name

3 comments

0

Do you get any errors? What in particular is wrong? Does it do anything?

0

it does nothing, I will update my question

0

you're reading touch.Parent.Name but you said the brick is not grouped whatsoever, so touch.Parent.Name is always going to be workspace.