Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Ideas on how to prevent spawn killing?

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?

1 comment

0

what about a safe zone around the spawn?

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

0

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

0

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.