Hi guys.
I have implemented Game Analytics in my game. So now I can see errors in Game Analytics dashboard.
I need help with one of the errors.
The error stacktrace:
Players.[LocalPlayer].PlayerScripts.PlayerModule.ControlModule: message=Players.[LocalPlayer].PlayerScripts.PlayerModule.CameraModule.LegacyCamera:71: attempt to index nil with 'ToEulerAnglesYXZ', trace=Players.[LocalPlayer].PlayerScripts.PlayerModule.CameraModule.LegacyCamera, line 71 - function Update
Players.[LocalPlayer].PlayerScripts.PlayerModule.CameraModule, line 496 - function Update
Players.[LocalPlayer].PlayerScripts.PlayerModule.CameraModule, line 136
After some investigation, I found that these modules are being attached to player at runtime, so I found that the problem is because of subjectCFrame is nil in the mentioned line
I can’t reproduce the issue myself, so I’m wondering if there are any thoughts in regards this issue ?
Thanks in advance.
1 Like
the error tells you that subjectCFrame is nil, and you can’t do nil:ToEulerAnglesYXZ()
1 Like
This can only be throwing an error if the module itself is being modified, reading the code, the module doesn’t give any obvious signs for the GetSubjectCFrame() method to return nil, as all code suggests it returns a CFrame of some type
Its best to leave the Camera module alone since it’s a built-in Roblox script, and try to diagnose if there’s any other code that might be causing the camera scripts to do this.
If you cant replicate the issue, and its only coming up every now and again, just leave it unless it affects everyone
2 Likes
If I’m not mistaken, I can’t modify this module, as it is not available in Editor , right?
So , I believe I didn’t modify the module )
I agree that the outside code may be the reason of this issue. However I’m wondering in which cases
the GetSubjectCFrame() can be nil ? So I can debug my code and move forward in a right direction
1 Like
The whole PlayerModule can be modified, simply just copy it out of PlayerScripts and into StarterPlayerScripts and it’ll overload the default one. (make sure to copy the whole thing, not just the camera)
Generally, it would be best to try and figure out whats happening internally before trying to make any fixes
2 Likes
Got it. thank you for your help!!!