Error with :GetPrimaryCFrame()

Hey there, I’m having an error in the output that appears just now.

exception while signaling: Model:GetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.

This has never happened to me before, and before you ask more, I did check the whole game for scripts that uses the function, and there’s no script. Also, I checked for viruses and used ScriptContext. No error was printed and there weren’t any viruses. You can’t trace back the script that is causing the error either, there was only a red text and non-clickable.

Edit: This error starts appearing when I started joining the game.

Do you have any malicious models and/or plugins?

1 Like

Every model in my game are by me, and there wasn’t any script. All plugins worked well, and this suddenly happened today.

For your first issue, make sure you set your PrimaryPart of your model, whether you do it in script or through studio’s Properties, you need to make sure you have a PrimaryPart set for your model before calling GetPrimaryPartCFrame()

For the second issue, it seems to me that the script isn’t waiting for Ocean to load in. Make sure you use WaitForChild() so instances can load into the workspace.

1 Like

If you can click it while you are testing, you could try adding something like “print(script.Parent, script.Name)” to find out which script is printing this error.
Also is the model that you are trying to get the primary CFrame from a model you made or a character model from a player? Also like @CapnFry mentioned, maybe the model didn’t exist yet so using WaitForChild() should solve it, you are meant to use :GetPrimaryCFrame() on a model if you didn’t realize yet, you probably knew that but just saying.

1 Like

Thanks for the suggestion. I just tried adding :WaitForChild() and it no longer shows the error, but the CFrame issue is still there.
As for the first issue, every model in my game has a PrimaryPart already. Don’t understand why it is showing that error.

1 Like

As I mentioned, there wasn’t any script in my game that was using this function. Printing wouldn’t work either (ScriptContext) so I think maybe this issue isn’t script-made (is that even possible?).

Let’s try using print to see if we can find any errors then. For your model use this code

print(-Your PrimaryPart-)

And see if it comes back with nil. That error wouldn’t be showing up unless you don’t have a PrimaryPart.

1 Like

This error is from a script, or you would not be getting the error in the first place.

1 Like

That isn’t possible so it has to be an error in a script you made, maybe you (accidentaly) removed a primarypart/model but you forgot to remove the script that tries to get the primary part cframe of the removed model?

1 Like

Also, are all the scripts inside of ServerScriptService or are they inside of a model in Workspace?

1 Like

There were no scripts in my game that were using the :GetPrimaryCFrame() function.

I’m pretty sure there is because no default scripts from roblox would give such error

1 Like

Most scripts are in ServerScriptService; there are some in models, but I checked every of them and there were none of them that were trying to get the PrimaryPart’s CFrame.

You get this error when you try to call getprimetypartcframe from am model with no primary part. Setting a primary part will fix it.

Could you possibly show me a little snipet of the code you are using to grab the PrimaryPart’s CFrame?

Also did you try to find the bug using that print() I showed you?

My guess is somewhere in your game a script deletes/moves the PrimaryPart of your model.

1 Like

There aren’t any script that was trying to grab the PrimaryPart’s CFrame.
Also, I did try the print and there weren’t any errors. But the error shows when I begin joining the game, so maybe it’s an Engine Bug?

I don’t see how the first statement you said creates a problem for finding the Primary Part’s CFrame, but could you show me the error please? I highly doubt it is an Engine Bug.

1 Like

It’s because I mentioned upon, I said I was having that error but I don’t know the cause of that problem. I can’t trace back, it almost seems like there was no script causing the error.

Ok, but you didn’t answer my question. Could you show me the error that popped up? I don’t want this to start to become spam.

1 Like