I have a script that is meant to stop a train(for a roller coaster) when it reaches the station for a brief moment. I have a property called active to prevent the function from running while already active. I have 5 MidCar body's and only 1 Lead car body. My script's function is to wait until the part(parent) is touched and to then anchor the entire train(using it's body's) for 10 seconds before letting the train continue moving again. I haven't tested the script yet but im not sure if it'll work due to the train having multiple duplicated Midcars. How can I change all 5 of the Midcars body's at once?
It's parent is just a normal block in the workspace called "Station"
Script
active=false
script.Parent.Touched:connect(function()
if active == false then
active=true
game.Workspace.DTrain.MilleniumLeadCar.BodyL.LeadBase.Anchored=true
game.Workspace.DTrain.MilleniumMidCar.Body1.Floor.Anchored=true
wait(10)
game.Workspace.DTrain.MilleniumLeadCar.BodyL.LeadBase.Anchored=false
game.Workspace.DTrain.MilleniumMidCar.Body1.Floor.Anchored=false
wait(10)
active=false
end
end)

4 comments
it said anchored it not a valid member of a model
Im guessing I should ungroup all the sub groups I have in the model
Are there any models inside of the model?
KK updated the post. Maybe this can help a little bit.