How do i make a safe zone area?

Me and my friend are making a Sword fighting type game. And we want to make a safe zone area so the players cant take damage with the swords. But every script i try wont work.

– Bolty447

You would need to add a custom bit of code to your sword that checks if the hit player is inside a safe zone or not. You can do this by using :GetTouchingParts() to see if the player is touching the safe zone.

You could simply give the player a force field when inside the safe zone.

1 Like

@ObliviousHD made a good module for making zones. Zone+ v1 (deprecated) | Retrieving players within an area/zone simply just do whay @Noob66662 said

That won’t work if he’s setting the health instead of using TakeDamage().

Then have an if statement inside the code he is working with/weapon to not damage the player if they’re within the zone/tagged in safe zone.

1 Like

Try making a Touched event and increase a players health 100+ every second so when a player attacks it will instantly increase.
After that make a TouchEnded event to stop the increase of health.

This not a proffessional way of making it.
I’m not that of a good scripter though.

That is unneccsarily unneccessary and would probably end up causing performance issues depending on the amount of people inside the safe zone.

Plus, it might not fire at times if the player stands still long enough. Same goes for TouchEnded.

A simple if statement to toggle off killing/damaging will work fine.


But you could use magnitude to find how far the player’s humanoid root part is from the safe zone and if the magnitude is below the maximum distance then the player’s character will recieve a force field.