Hey, if you have seen my previous posts you know that I’m currently working on a gun system. I just wanted to make this post because I’d like to implement an OTS effect to my weapons but I’m unsure of the best way to do this. If you have a detailed video or a personal explanation it would be greatly appreciated! (For those of you who don’t know OTS stands for Over-The-Shoulder)
For the sake of simplicity, you can create a new part instance like this: (in a local script)
local CamPart = Instance.new("Part", player.Character)
then you can add a weld to it:
local w = Instance.new("Weld", CamPart)
and set up the values of the weld. Part0 = player.Character.Head Part1 = CamPart C0 = CFrame.new(0,0,0) C1 = CFrame.new(-3,5,0) (You should change those values to fit your needs so that the part appears just above the player’s shoulder)
Then you can setup a function to move the camera:
local function moveCam()
workspace.CurrentCamera.CFrame = CamPart.CFrame
end
game:GetService("RunService"):BindToRenderStep(moveCam)
You can also set up Tweens if you want the camera to more fluidly move from one point to another, but make sure to consider performance, and take steps to make sure it’s not creating Tween’s when there is not movement using something like:
local dist = (workspace.CurrentCamera.CFrame - CamPart.CFrame).magnitude
I hope this helps! Let me know if this works for you!