I made a script that puts the player in third person when equipped however when I unequip it and change the offset back I want to keep the same distance so it is a clean transition.
local tool = script.Parent
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")
local thirdPersonCameraOffset = CFrame.new(0,1,10)
local NormalCameraOffset = CFrame.new(0,-1,-10)
tool.Equipped:Connect(function()
camera.CameraType = Enum.CameraType.Scriptable
player.CameraMode = Enum.CameraMode.LockFirstPerson
RunService.RenderStepped:Connect(function()
camera.CFrame = camera.CFrame * thirdPersonCameraOffset
end)
print("works")
end)
tool.Unequipped:Connect(function()
camera.CameraType = Enum.CameraType.Custom
player.CameraMode = Enum.CameraMode.Classic
RunService.RenderStepped:Connect(function()
camera.CFrame = camera.CFrame * NormalCameraOffset
end)
end)
I don’t want to be scrolling our every time, how would I fix this