Hey, I'm saving about anywhere from 30-40+ parts Rotation x,y,z into a datastore, but when I go to load up that datastore some of the values are nil, which then either breaks the script when loading or I have to remove any values that are nil which means any other part after that will have odd rotational values.
Is there any way to make sure the datastore is saving the values correctly and nothing is going through as nil?
I'm doing it like this at the moment, because it's the closest I've had it to working is using 4 different datastores for each type of value.
Here is the adding to the table part. Upon loading the values it seems to be models that are rotated 180,0,180 or 0,0,0 are switch with each other and have the opposite values. It's a bit annoying really because I've spent 4 days trying to sort this problem.
objectNames = {} objectRX = {} objectRY = {} objectRZ = {} findItems = game.Workspace.Tycoons[findTycoon].Objects:GetChildren() for i = #findItems, 1, -1 do table.insert(objectNames,i,findItems[i].Name) table.insert(objectRX,i,findItems[i].Hitbox.Rotation.X) table.insert(objectRY,i,findItems[i].Hitbox.Rotation.Y) table.insert(objectRZ,i,findItems[i].Hitbox.Rotation.Z) end
If anyone can help here or even help me on codeshare.io that would be fantastic! Thanks for your time.
I would do something like:
XRot = nil while XRot == nil do XRot = findItems[i].Hitbox.Rotation.X end table.insert(objectRX,i,XRot)
and it probably would solve my problem. Because you know, if findItems[i] isn't nil, it won't loop forever. Even if it is, it would break the script and stop looping.