Does anyone know how could i implement this to my zombie game?

Hello Developers!

Ive maded an zombie survival game on Roblox, based off Left 4 Dead 2 by Valve!

However, i want to implement the ghost spawning mechanic, let me explain it.

I want my infected players be able to spawn if the survivors aren’t in that area, even if they aren’t looking at it, i know how to code it, but i don’t know how i could implement that feature.

[EXAMPLE IMAGE]
As you can see on this image, theres an player infected that cant spawn even if the survivor isn’t looking at that area he is currently.

With all the research i’ve done, i can confirm it has something to have with player’s camera or raycasting.

I’ve also seen another zombie game with the same mechanic.

2 Likes

There’s this function whose second return value tells you if the given point in 3D is visible in the given camera: Camera | Roblox Creator Documentation

Hmmm i see, but that would that stop infected players from spawning behind the player or in the same area they are?

You can detect the area they are in using ZonePlus:

1 Like

Interesting post, but is there any way to do it with the camera or raycasting?