Hi folks, back with another error that I really would like to get to the bottom of. I have sensors located along my track, each of them are supposed to either disable the trail effects from the car whilst airborne or enable them when back on the ground and has touched the sensor. Here's what I've tried, it works but only for one and none of the others.
script.Parent.Touched:Connect(function(Active) for i,v in pairs(Active.Parent:GetChildren())do if v.Name == "TrailEffects" then spawn(function() v.Parent.TrailEffects.Trail.Enabled = false end) end end end)
As you can see, it's a short script and I'm no doubt missing a lot, but I'm still trying to learn new techniques and such. Thank you all sincerely for any help you can provide me with. Hopefully I can give back to you all when scripting becomes one of my strong points.
It's because by calling
v.Parent.TrailEffects.Trail.Enabled = false
you go to the same object (in other words - first object named 'TrailEffects') Change v.Parent.TrailEffects to just v, so it will be:
v.Trail.Enabled = false