#Jumpscare

1 messages · Page 1 of 1 (latest)

charred jasper
#

Im trying to make a jumpscare system when my killer is within reach of the player. Currently the camera gets teleported to the wrong position when the kill sequence is in action. Heres it the document with the 2 scripts: https://docs.google.com/document/d/1G0Fe3LfmU4_BXaE2-tv3xVS1NfZYGSnqpF-hc_RdY1A/edit?usp=sharing

main fossil
#

your server script is passing a name string, but it’s not actually giving the player's camera a specific target to lock onto

#

change TeleportToDeath:FireClient(visiblePlayer, killerType)
to
TeleportToDeath:FireClient(visiblePlayer, npc)

#

then you need a local script for the local player to actually move the camera

#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportToDeath = ReplicatedStorage:WaitForChild("TeleportToDeath")
local camera = workspace.CurrentCamera

TeleportToDeath.OnClientEvent:Connect(function(killer)
    if not killer or not killer:FindFirstChild("Head") then return end
    
    -- this stops the player from moving their camera around
    camera.CameraType = Enum.CameraType.Scriptable
    
    -- position the camera 3 studs in front of the killers face
    local killerHead = killer.Head
    local facePosition = killerHead.CFrame * CFrame.new(0, 0, -3) 
    
    --point to the camera directly at the killers eyes
    camera.CFrame = CFrame.new(facePosition.Position, killerHead.Position)
end)
#

no matter which way the killer is rotated when they catch you, the camera will always be perfectly centered on their face.

#

lmk if it works or not

charred jasper
#

Hi! I tried it and it doesnt seem to work. Now the camera doesn't even teleport. I may have put the localscript in the wrong place, lmk where i should put it. 😁

charred jasper
#

@main fossil