Hello, I am working on a game and I am trying to figure out a way to prevent spawn killing. How could I detect if a player is at the enemies spawn and if they are at their spawn to make the enemies spawn at the opposite side? I attempted to do this with a Touch function and a part but it doesn't seem very efficient. Any ideas?
Ideas on how to prevent spawn killing?
2 answers
There's an article about this kind of problem on the wiki here
If you wanted to find how close someone is to a point, you can use
point = Vector3.new(0,0,0)
distance = (player.Character.Torso.Position - point).Magnitude
Make a part that is invisible and size it so that it makes a box around the spawn, then you could use a touched event to figure out if an enemy player is inside the box, and if so, that player will not be able to damage the players spawning in.
Edit: make sure to turn canCollide to false too.
2 comments
I like this idea but the touch event can cause lag. So for example if the player is holding a gun with lots of parts the event will trigger for each part even with a debounce and cause a lag ya know
You can make customized debounces to prevent the touched event from even triggering
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
what about a safe zone around the spawn?