Camera won’t go back to normal after hopping off the seat

Hello, I’m pretty new to scripting and I need help figuring this out. When I sit on the seat part, it goes to a part facing a certain direction which works well, the problem is getting the camera back on the character, it’s stuck on the part when I jump off the seat. I need help figuring this out.

canuse = true

local cam = game.Workspace.CurrentCamera
local Subject = script.CameraSubject.Value
local Occupant = script.Seat.Value.Occupant

while wait() do
	if (Occupant ~= nil) then
		if (canuse == true) then	
			canuse = false	
			wait(0.05)
			if cam.CameraType == Enum.CameraType.Custom then
				repeat wait()
					cam.CameraSubject = Subject
					cam.CameraType = Enum.CameraType.Scriptable
				until cam.CameraType == Enum.CameraType.Scriptable
				cam.CFrame = script.CameraSubject.Value.CFrame
				cam.FieldOfView = 73

			else
				cam.CameraSubject = game.Players.LocalPlayer.Character.Head
				cam.CameraType = Enum.CameraType.Custom
				cam.FieldOfView = 70
				canuse = true
			end
		end
	end
end

set cameratype to custom right after you jump off seat

I think it’s because you have the debounce canuse = true caught in the last else section. Whn your if canuse == true section runs then canuse never gets set back to true.
Try moving it down 2 lines.

What is CameraSubject.Value?
You set cam.CameraSubject to Subject, but Subject is set as script.CameraSubject.Value in the beginning of the script…

yeah that’s what i thought too, i would just set cameratype to custom 0.1 seconds after jumping off the seat

local Game = game
local Workspace = workspace
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = Workspace.CurrentCamera
local Seat = Workspace:WaitForChild("Seat")

local function OnOccupantChanged()
	if Seat.Occupant and Seat.Occupant == Humanoid then
		repeat
			Camera.CameraType = "Scriptable"
		until Camera.CameraType.Name == "Scriptable"
	else
		repeat
			Camera.CameraType = "Custom"
		until Camera.CameraType.Name == "Custom"
		Camera.CameraSubject = Humanoid
	end
end

Seat:GetPropertyChangedSignal("Occupant"):Connect(OnOccupantChanged)
1 Like