New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

How can I make a modified version of the ShiftLock Camera?

Asked by 3 months ago
Edited 3 months ago

Hello there,

I'm making a 3rd person platformer/shooter, and have been tearing my hair out over the camera. You see, I want a version of ShiftLock that doesn't focus the camera so low, since I still need to aim. I tried many different scripts I have dug up but cant seem to make heads or tails of any of them, or how to modify them correctly-- whenever they weren't broken. Any help is greatly appreciated with this topic, and I wanted to thank you for your patience, as this seems like such a question asked ad-nauseum.

I've tried this script here, but cant seem to move my camera along the Y-Axis. I also wanted to know if there was a way to enable and disable this modified camera upon the equipment of a tool, as well as fix the issue of the camera clipping through the environment

userInputService = game:GetService("UserInputService")
contextActionService = game:GetService("ContextActionService")
runService = game:GetService("RunService")
player = game:GetService("Players").LocalPlayer
camera = game.Workspace.CurrentCamera

userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter --Lock mouse to center

x, y = 0, 0;
function getMouse(name, state, inputObject)
    x = x + (-inputObject.Delta.x/250)
    y = y + (-inputObject.Delta.y/250)
    if y > 5 then --Top camera angle limit
        y = -5 --Change this as well
    elseif y < -5 then --Bottom camera angle limit
        y = -5 --Change this as well

function camUpdate(hrp)
    hrp.CFrame = * CFrame.Angles(0,x,0);

    local character = player.Character
    local hrp = character:FindFirstChild("HumanoidRootPart")
    if hrp then
        camera.Focus = hrp.CFrame *,1,0)
        camera.CFrame = hrp.CFrame *,1,12) 
to make a modified version of shift lock, TheluaBanana 883 — 3mo
one must first make a modified shift lock TheluaBanana 883 — 3mo
Show us the scripts you tried. songboy50 68 — 3mo
Since you haven't provided us with any code we can't help you but ill give you a clue and the clue is to read this there is something called Mouse.LockCenter it might interest you Prestory 1390 — 3mo
My apologies. I had a script, and this was late at night, so I didnt think to post it. creamsodacrusader 9 — 3mo

Answer this question