so I'm making this invisible block that when you touch it forces you into first-person perspective. I got an error saying "Workspace.FirstPersonActivator.Script:3: attempt to index nil with 'CameraMaxZoomDistance'" in the output box. I don't understand the error message. can someone help?
local player = game.Players.LocalPlayer script.Parent.Touched:Connect(function() player.CameraMaxZoomDistance = 0.5 end)
Usually I do not use local scripts inside the workspace, so instead I would use something like this in a normal script:
script.Parent.Touched:Connect(function(hit) local hum = script.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then player.CameraMode = Enum.CameraMode.LockFirstPerson end end)