Over-The-Shoulder Camera System

It looks great in-game, yet when I use the provided model I’m met with Errors.

I did the localScript as instructed:

local OTS_CAMERA_SYSTEM = require(script["OTS Camera System"])

OTS_CAMERA_SYSTEM:Enable()

7 Likes

The same is happening to me :confused:

4 Likes

Fixed it! It’s because the Module is being required before the Character is fully loaded.

Throw in a:

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait(1)
4 Likes

How do you enable it / start it because i dont understand :frowning:

4 Likes

Read older replies, people explained it.

2 Likes



Still doesn’t work :confused:

4 Likes
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait(1)
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local OTS_CAMERA_SYSTEM = require(script["OTS Camera System"])
OTS_CAMERA_SYSTEM:Enable()

Try this one?

4 Likes

Kinda works, but you can’t rotate camera or anything :confused: (There isn’t anything in output

2 Likes

It would be cool when the camera is enable the camera position will be the same where the character rotated

4 Likes

Is there a way that I can toggle shoulders using one key? I plan to use ‘E’ for something else.

2 Likes

Hi, does this have mobile and xbox support?

Looking forward to answers.

2 Likes

This could be because the ROBLOX default camera scripts loaded after this OTS camera system did and thus the CameraType became Custom instead of remaining Scriptable, which stopped the OTS camera system from working properly. I will fix this in an update.

The camera is switched using inputs from line 301 to line 305:

if (inputObject.KeyCode == Enum.KeyCode.Q) then
	singleton:SetShoulderDirection(-1)
elseif (inputObject.KeyCode == Enum.KeyCode.E) then
	singleton:SetShoulderDirection(1)
end

You can replace this with the following to change camera direction with just Q:

if (inputObject.KeyCode == Enum.KeyCode.Q) then
    	singleton:SetShoulderDirection(-singleton.ShoulderDirection)
end

I haven’t tested it but it should work. Let me know if it doesn’t.

It should work for mobile (although as an unintended effect) but not xbox. I will make an update to support both mobile and xbox with greater customizability.

4 Likes

Works perfectly, thanks! :smiley:

2 Likes

Could I get an explanation of how the feature of making the character rotate with the camera can be enabled? I tried changing IsCharacterAligned to true in the module script but that didnt work.

EDIT: Nevermind, figured it out! For anyone with the same issue do this right under your Enable()

OTS_CAMERA_SYSTEM:SetCharacterAlignment(true)

4 Likes

However I was wondering if there was a way to keep your camera from snapping back to the default position when re-enabling the script after disabling it :slight_smile:

1 Like

Glad you figured out the earlier issue and thanks for sharing your solution. If I understand correctly, what you are asking is for the camera to enable itself with the same vertical and horizontal angles as it was disabled with. By default, the camera system resets the angles before and after it enables and disables using these functions (at the same line numbers in ROBLOX modulescript):

You can remove the two statements that reset the angles from both of these functions. The statements are:

self.HorizontalAngle = 0
self.VerticalAngle = 0

Hopefully, now if you enable the camera system again, it should start at the older angles. This is untested so let me know if it doesn’t works out.

1 Like

So it doesnt snap back to the default position but it does snap back to where you last left off with it on, any ideas?

1 Like

Do you want it to snap to whatever rotation the camera currently had before you enabled it? If that’s the case, this is a nice functionality that I can add to the camera system. Thanks for the idea, I will update this by tomorrow (I have to sleep now). I’m sorry but I’ll have to ask for patience from you in the meantime.

1 Like

Thats fine, Im using it to snap players into an OTS form with guns, i just think they would get frustrated if they left off facing east and had to re-equip facing west and found themselves with their back to the enemy!

1 Like

I updated the camera system and now you should be able to enable the camera without resetting the angles. Let me know how it goes.

1 Like