Hello, I am working on a game that uses tools and I need a safe zone, but I wasn’t able make it work so I decided to come to the dev forum because I know people are more talented and have a much better scripting knowledge than I do.
I am an amateur scripter and I am still learning things
The Safe Zone:
I just want a tool to appear when ur outside the safe zone and disappear from the player inventory when inside the safe zone.
Here is my also inexperienced answer: Perhaps you could put an invisible part with no collisions over the whole safe zone area and then use it to trigger an event when the player touches it. While touching it they would have the tool, once not it would be removed?
Also,
Did you mean appear when inside and disappear when outside? Since you said outside twice.
Like when you enter the safe zone the tool will be removed from the player backpack and when he leave the safe zone it will come back to the player backpack
You should make a part and use Region3 to check if players are in that region. If not, then parent the tool to either the character or their backpack and vice versa. Hope this helped!
I don’t recommend using Touched to do this.
I suggest you create a local script and create a touch function (Touched,TouchEnded) detect if that object is Localplayer’s part and then Disable their Backpack and unequip their tool and then when the TouchEnded detect if that object is LocalPlayer and then Enable their Backpack, This is my basic strategy but you can try what TherDan said cause it’s actually better in term of anti exploit
I had a lot of experience with such stuff. Let’s say that when you go through a hole in the wall, stuff with tool happens. Here’s what it should be like:
Zone where player needs the tool.
Trigger to add tool in his inventory. Transparent, anchored, cannot collide, named ToolPart
Hole in the wall.
Trigger to remove tool from his inventory. Transparent, anchored, can’t collide, named NoToolPart.
Zone where player doesn’t need the tool.
All triggers 1 stud thick, server-sided script removes tool when player touches NoToolPart and adds it when player touches ToolPart.
I use this method in my game, and it works pretty well.
Also, use workspace:FindPartsInRegion3() to check if theres any player in the safezone.
Here’s a tutorial that you might find useful:https://www.youtube.com/watch?v=qOhZi1jUEvI