I am trying to make a Jumpscare system for me and my friend’s game. And I started off trying to make the player’s camera switch to a part that will function as the jumpscare camera (It’s in a special box with the jumpscare NPC and all of that stuff.
The problem is that I wrote this script that’s going to make the camera switch doesn’t work. I added a print function to check if the script even functions. The script did print the message but it did not switch the camera.
This is the script:
local camera = game.Workspace.CurrentCamera
local cameraPart = game.Workspace.JumpscareBox.JumpscareCam
local function switchCamera()
camera.CameraSubject = cameraPart
camera.CameraType = Enum.CameraType.Scriptable
print("moist")
end
local detectPart = script.Parent
detectPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
switchCamera()
end
end)
Why would I be writing about this if there was nothing like this on Devforum or the internet overall?
As always there were no errors in the output box except the text that the script printed. It would be nice if I knew why it printed the text but didn’t switch the camera.