So, I've been making a script that requires an integer value to put into a spawned object (to know which it is, reason not important to problem) , but it keeps giving me errors that the object does not exist. I've had this problem for months, I've asked around but no one is able to help because it makes no sense! The integer object the script tries to locate exists in the same place at all times, its parent never changes, nor its name, yet the script still errors saying it doesn't exist there. The error message is as follows: Depots_and_trains is not a valid member of Workspace "Workspace"
Depots_and_trains is a folder in the workspace. Why can't it find it? Its RIGHT THERE!!!
I've also had similar problems where it cannot find other objects, despite it existing there. I've tried finding it from game.workspace.(location) and script.parent(and so on...) but neither works, both giving errors that it cannot be found where it LITERALLY EXISTS!!! I would really appreciate any help! Please feel free to ask questions!
Below is the line of code that gives the error:
local NAobj = game.Workspace.Depots_and_trains.Franklinton_MainLine_Depot.Class37_Trains.NextAddress.Value
Edit: Seems to be that it thinks Workspace is a folder? TrainsSpawned is not a valid member of Folder "Workspace.DepotsAndTrains.FranklintonMetroDepot.DStockTrains" (Different code, but similar error originating from the same code)

2 comments
Try printing all the children of the workspace, use :GetChildren() and then itterate through that table. See what it outputs.
I've already tried that before, and I've tested in studio. The object is still there, yet it can't find it! I honestly don't know why this is happening