So. I have a script. Only one part wrong with it.
tab= workspace:GetChildren() -- This line causes the problem. But there is also no error.
for i, v in pairs(tab) do
if v.Name == "Rail" then
v.Script:Destroy()
script.changer:Clone().Parent = v
v.changer.Disabled = false
print('New Script Done.')
end
end
It is supposed to add a new script to every part named "Rail" because I am lazy and i found a mistake and i don't want to go through each individual piece and fix it. Anyway, I found the reason why it isn't working, which is the fact that each of those pieces is in a model , in a model, in workspace, and I cannot get the to the rail piece because :GetChildren() does not work that way. Is there another method that can go in place of :GetChildren() that allows me to get all of the instances in workspace? Thank you and have a nice day.

3 comments
Ah. That is a way I hadn't even thought about. Thanks for the answer, Digital. I just learned some new things.
No problem. If I helped, remember to upvote and hit that 'accept answer' button! :D
Both of you tried, but I just added some more for loops and it is working. Thanks for the help from you both. I would go with yours, but I didn't really want to make a function.