I am trying to make the camera change to a certain object when they touch a part, I have this code and it wont work… I have no error untill I leave the game. This is the error ServerScriptService.CutsceneTrigger:18: attempt to index nil with 'Humanoid' and I have no idea why this wont work.
local Players = game:GetService("Players")
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
debounce = false
function Trigger1()
if debounce == false and player:FindFirstChild("Humanoid") then
debounce = true
repeat wait() until player.Character
cam.CameraType = "Scriptable"
cam.CFrame = workspace.CutsceneCamera.CamPart.CFrame
wait(6)
cam.CameraSubject = player.Character.Humanoid
cam.CameraType = "Custom"
cam.CFrame = player:FindFirstChild("Head").CFrame
wait(10)
debounce = false
end
end
workspace.CamTrigger1.Touched:Connect(Trigger1)
This script is in a LocalScript in ServerScriptService could anyone help me?
Here are some images of where thing’s are in my game.
![]()
