Why does my code not work i am making it so when you press left shift you go from first person to third person mode
my code:
UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson
UserInputService.InputBegan:Connect(function(input,gameprossideEvent)
if input.KeyCode == Enum.KeyCode.LeftShift then
player.CameraMode = Enum.CameraMode.Classic
end
end)
is there a better way or a reson my code does not work?

10 comments
does it show any errors?
is it a local sceript
is it a localscript and in StarterPlayerScripts?
No errors
it is a local script
not in StarterPlayerScripts
put it in starterplayerscripts
Not working
Please go to the link below and follow the steps provided.
Please go to the link below and follow the steps. put it in starterpack and then when you click e (you can change it in the script if you want) you will be in first person and if you will press e again you will be in third person. Link is https://www.roblox.com/library/243187556/switch-from-fp-to-tp-third-person-in-a-key