Hello friends, so i have this script for a jumpscare with a model i made. Ive been following a tutorial and adapting it and changing some stuff to work better with my idea but i have a problem that the jumpscare is using FireAllClients and i want it to use FireClient but i dont understand from the forums or developer guides how to properly use it and make it work. Im stuck. Any help?
This is my current code in ServerScriptService for the jumpscare.
local cameraInterpolateEvent = game.ReplicatedStorage.RemotesModelJumpscare.cameraInterpolateEvent
local cameraToPlayerEvent = game.ReplicatedStorage.RemotesModelJumpscare.cameraToPlayerEvent
local alreadyPlayed = false --For one of a time jumpscares
game.Workspace.Hellast.HellastPVE.KillPart.Touched:Connect(function(hit) --Define the part that on Touch will trigger the jumpscare
if hit.Parent:findFirstChild("Humanoid") then
if alreadyPlayed == false then
alreadyPlayed = true
local monster = game.ReplicatedStorage.HellastJumpscareModel:Clone()
monster.Parent = game.Workspace
monster.Cabeza.Head.Cabeza.HellastSound:Play()
cameraInterpolateEvent:FireAllClients(game.Workspace.JumpscareKit.CameraPosition.CFrame,game.Workspace.JumpscareKit.CameraAim.CFrame,0.2)
wait(4)
cameraToPlayerEvent:FireAllClients()
monster:Destroy()
alreadyPlayed = false --To reset jumpscare availability
end
end
end)
I also have this local script for the camera interpolate stuff in StarterCharacterScripts
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local cameraInterpolateEvent = game.ReplicatedStorage.RemotesModelJumpscare.cameraInterpolateEvent
local cameraToPlayerEvent = game.ReplicatedStorage.RemotesModelJumpscare.cameraToPlayerEvent
cameraInterpolateEvent.OnClientEvent:Connect(function(posEnd,focusEnd,duration)
if player.Character then
if player.Character.Humanoid.Health > 0 then
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera:Interpolate(
posEnd,
focusEnd,
duration
)
end
end
end)
cameraToPlayerEvent.OnClientEvent:Connect(function()
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
end)
Thank you for your time