So, I’m trying to make a shoulder cam whenever my tool is equipped, and return the camera to normal when it’s unequipped. It works when it’s equipped, but it doesn’t work when it’s unequipped. Along with this, the camera is constantly zooming out when equipped. All help appreciated!
Equip:
local RunService = game:GetService("RunService")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local thirdPersonCameraOffset = CFrame.new(2,0,8.5)
cam.CameraType = Enum.CameraType.Scriptable
RunService.RenderStepped:Connect(function()
cam.CFrame = cam.CFrame * thirdPersonCameraOffset
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end)
Unequip:
local RunService = game:GetService("RunService")
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local thirdPersonCameraOffset = CFrame.new(2,0,8.5)
cam.CameraType = Enum.CameraType.Custom
player.CameraMode = Enum.CameraMode.Classic
RunService.RenderStepped:Connect(function()
cam.CFrame = cam.CFrame - thirdPersonCameraOffset
end)
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local thirdPersonCameraOffset = CFrame.new(2,0,8.5)
cam.CameraType = Enum.CameraType.Scriptable
RunService:BindToRenderStep("ShoulderCam", Enum.RenderPriority.Camera.Value -1, function()
cam.CFrame = player.Character.PrimaryPart.CFrame
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end)
unequip:
local RunService = game:GetService("RunService")
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
cam.CameraType = Enum.CameraType.Custom
player.CameraMode = Enum.CameraMode.Classic
RunService:UnbindFromRenderStep("ShoulderCam")
Overall very good! But, the problem is that when the player pressed A or D, the camera spins wildly. Secondly, is there a way to make it so you can move the camera around?