Why can't I reset the player's camera after tweening?

Okay, so I have a script that tweens the camera between locations, but when you press the “spawn” button the camera is supposed to reset but for some reason I keep getting A BUNCH of weird and long errors after each other. This is the code i’m getting:

Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera:1502: invalid argument #3 to ‘clamp’ (max must be greater than or equal to min)

RunService:fireRenderStepEarlyFunctions unexpected error while invoking callback: Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera:1502: invalid argument #3 to ‘clamp’ (max must be greater than or equal to min) - Studio
14:46:55.325 Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera:1502: invalid argument #3 to ‘clamp’ (max must be greater than or equal to min) - Client - BaseCamera:1502
14:46:55.326 Stack Begin - Studio
14:46:55.327 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera’, Line 1502 - function CalculateNewLookCFrameFromArg - Studio - BaseCamera:1502
14:46:55.327 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera’, Line 1510 - function CalculateNewLookVectorFromArg - Studio - BaseCamera:1510
14:46:55.328 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule.ClassicCamera’, Line 303 - function Update - Studio - ClassicCamera:303
14:46:55.328 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule’, Line 527 - function Update - Studio - CameraModule:527
14:46:55.329 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule’, Line 161 - Studio - CameraModule:161
14:46:55.329 Stack End - Studio
14:46:55.329 RunService:fireRenderStepEarlyFunctions unexpected error while invoking callback: Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera:1502: invalid argument #3 to ‘clamp’ (max must be greater than or equal to min) - Studio
14:46:55.348 Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera:1502: invalid argument #3 to ‘clamp’ (max must be greater than or equal to min) - Client - BaseCamera:1502
14:46:55.349 Stack Begin - Studio
14:46:55.349 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera’, Line 1502 - function CalculateNewLookCFrameFromArg - Studio - BaseCamera:1502
14:46:55.349 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera’, Line 1510 - function CalculateNewLookVectorFromArg - Studio - BaseCamera:1510
14:46:55.350 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule.ClassicCamera’, Line 303 - function Update - Studio - ClassicCamera:303
14:46:55.350 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule’, Line 527 - function Update - Studio - CameraModule:527
14:46:55.350 Script ‘Players.crossbar.PlayerScripts.PlayerModule.CameraModule’, Line 161 - Studio - CameraModule:161
14:46:55.351 Stack End - Studio
14:46:55.351 RunService:fireRenderStepEarlyFunctions unexpected error while invoking callback: Players.crossbar.PlayerScripts.PlayerModule.CameraModule.BaseCamera:1502: invalid argument #3 to ‘clamp’ (max must be greater than or equal to min)

As you can see I have NO ideas what this means nor why it’s so complicated to simply revert the camera back to normal. This is my reverting camera code so you can see:

camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid – Reset the settings of the camera
camera.CameraType = “Custom”

player.Character.Humanoid.WalkSpeed = 16

If someone could help me on this, that would be great.

Please help me out, this has been bugging me for awhile and I need to get good sleep

This isn’t anything to do with your code, it’s corescript errors. Those errors have been being outputted for awhile.

So how can I possibly override this or find an alternative so I can reset the camera? Thanks

Try setting the cameratype to custom before setting the subject to the humanoid.

Thanks, but I just copied the code from this article here: What's the best way to reset a player's camera and it fixed it- or at least it didn’t run into the problem.

Hmmm. Could you maybe provide the part of your script where you’re actually manipulating the camera?

Also on a sidenote, you can format your script to be readable on the forum by using this:

```
script here
```

Sure so this is what I had before:

camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid -- Reset the settings of the camera
camera.CameraType = "Custom"

And I changed it to this:

camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
camera.CameraType = "Custom"
camera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame

And the error was mysteriously gone, it reverts the camera perfectly back to the player again.

2 Likes

Sorry, I’m a little confused.

Those errors in your original are going to be outputted, regardless of whether you manipulate the camera or not. They have been there for awhile. If you stand in an empty baseplate for a little while, it’s still going to output those errors.

If the second method works for you, I am a little confused as to what you are asking haha.

Oh I didn’t know that the second method would work- I overlooked it because I thought the problem was coming from a humongous source of problems. Thanks for the help tho, your tip made me replace the code when you told me that it was from the machine.

1 Like

I had the same issue when using tweens for a menu I made, for me the fix was to add a wait(1) before the script managing the menu did anything. I believe its because the client tried to tween before the game loaded.

I am now facing the exact same issue, where the tween wont resent back to custom and shows this error. + This already waits a 6 whole seconds before firing the script. Any solutions?

(PS: I will message if I find a solution)

Okay, I basically changed the position of the part by just one stud and it started working normally. Could be some issue with the position of parts, but im not sure. Hope this helps anyone in the future facing the same problem.

1 Like