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.
0

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

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
end
end
contextActionService:BindActionToInputTypes("MouseMove",getMouse,false,Enum.UserInputType.MouseMovement)

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

runService.RenderStepped:connect(function()
local character = player.Character
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
camUpdate(hrp)
camera.Focus = hrp.CFrame *  CFrame.new(3,1,0)
camera.CFrame = hrp.CFrame *  CFrame.new(3,1,12)
end
end)

0
to make a modified version of shift lock, TheluaBanana 883 — 3mo
0
one must first make a modified shift lock TheluaBanana 883 — 3mo
0
Show us the scripts you tried. songboy50 68 — 3mo
0
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 https://developer.roblox.com/api-reference/property/UserInputService/MouseBehavior Prestory 1390 — 3mo
0
My apologies. I had a script, and this was late at night, so I didnt think to post it. creamsodacrusader 9 — 3mo