This is a localscript that should, when working, allow the user to click on the click detector and look around from the CameraPart's position, for my horror game to check through the peephole. They also have the ability to press Q to go through the door. Neither of these are working. (yes ive tried AI, friends, other discords, dev forum, docs, etc)
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local camera = Workspace.CurrentCamera
local door = Workspace.DoorSystemByBlaze.Door2
local knob = door.Knob
local clickDetector = knob:FindFirstChild("ClickDetector")
local destination = door.Destination
local cameraPart = door.Camera
local canTeleport = false
clickDetector.MouseClick:Connect(function(clickingPlayer)
if clickingPlayer ~= player then return end
canTeleport = true
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(cameraPart.Position, cameraPart.Position + cameraPart.CFrame.LookVector)
end)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed or not canTeleport then return end
if input.KeyCode == Enum.KeyCode.Q then
local character = player.Character
if character then
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
hrp.CFrame = destination.CFrame + Vector3.new(0, 3, 0)
end
end
camera.CameraType = Enum.CameraType.Custom
canTeleport = false
end
end)
player.CharacterAdded:Connect(function()
camera.CameraType = Enum.CameraType.Custom
canTeleport = false
end)
** You are now Level 5! **