So i’m trying to change the cframe of a camera when this ai monster hits the player, so im firing a client from the enemy ai script.
the problem is one of the variables is being swapped, and the other is returning nil.
small section of server script:
if debounce == false then
debounce = true
print(plr) -- coming back my name (plr)
print(target) --coming back my name (character)
jumpscareremote:FireClient(plr, script.Parent.ScareCam)
npc.Head.AttackSound:Play()
walkAnim:Stop()
attackAnim:Play()
target.Humanoid.Health -= DAMAGE
task.wait(0.5)
walkAnim:Play()
debounce = false
end
local script:
local rs = game:GetService("ReplicatedStorage")
local remote = rs:WaitForChild("jumpscare")
local camera = workspace.CurrentCamera
remote.OnClientEvent:Connect(function(plr, jumpscareCamera)
print(plr) --coming back the name of jumpscareCamera
print(jumpscareCamera) -- coming back nil
camera.CFrame = jumpscareCamera.CFrame
end)
ive had this problem before and i tried to see how i fixed it before, but it was less similar then i thought it was.