I have a local script in starterplayerscripts that changes a player’s camera mode whenever they enter or exit a seat, it works fine when I first try to use the script, but when the player dies, respawns, and then tries to enter a seat again, the script doesn’t work anymore.
Here is the script, how could I fix this?
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
char:WaitForChild("Humanoid").Seated:Connect(function(isSeated, seat)
if isSeated then
print("player is seat")
plr.CameraMode = Enum.CameraMode.Classic
plr.CameraMaxZoomDistance = 70
plr.CameraMinZoomDistance = 30
end
if not isSeated then
print("player is not in seat")
plr.CameraMode = Enum.CameraMode.LockFirstPerson
plr.CameraMaxZoomDistance = 0.5
plr.CameraMinZoomDistance = 0.5
return
end
end)