So I’ve got a script that automatically moves to a model’s Primary part, however, on specific models, the part will just stop at it instead of moving back where it came from like the script says, and in script output, it keeps showing " attempt to index nil with ‘position’. as if the primary part does not exist.
Things I’ve tried:
checking the models that the part moves to (they all have the same names and instances and such in them)
checking for primary parts (They ALL have one)
no scripts are affecting anything.
nothing on the dev forum shows anything similar. either
Until Then The part just stops moving every time and I cant figure out what is causing this.
Are you perhaps moving the part as soon as the script starts? If so, you should yield the script until the model.PrimaryPart is not equal to nil, as it might have not loaded in yet. Please provide us with your script, though.
So this is hard to help you with. This likely depends very specifically on how your script is set up and we don’t have that or the explorer setup, so it’s all just guesses. The others have made a great suggestion about ensuring the primary part exists. But I want to add another suggestion. Make sure you are actually getting the model you think you are. A frequent issue people will hit is naming siblings the same name then trying to do something like workspace.npc. But if there are 2 things named workspace.npc then you effectively have grabbed a random one when you likely meant to reference a specific one.
if you grab the primary part and set it as a variable just to make sure to primary part isn’t changed or something and you’re always working w the right part