✓ Accepted answer
Region 3
Region3 is a form of a datatype and is primarily used to detect if a player is in a certain area. this is used to play music in a certain area, or make a safe zone.
It sounds cumbersome but It's is useful in a lot of games, like my own.
First create a local script, preferably in the starter player.
Create a block that fills your place, another-words create a block where you want the part to stay in. Name it RegionPart
Now enough talking let's get to scripting!
First we need to reference our Region in a variable. And find it's original position so we can object the part to it's general position when it leaves the region.
local Part = game.Workspace.Part
local RegionPart = game.Workspace.RegionPart
local OriginalPosition = Part.Position
local pos1 = RegionPart.Position - (RegionPart.Size / 2)
local pos2 = RegionPart.Position - (RegionPart.Size / 2)
local Region = Region3.new(pos1, pos2)
while wait() do
local IsPartInRegion = workspace:FindPartsInRegion3(Region,(
for i, part in pairs(IsPartInRegion) do
if part.Parent:FindFirstChild("Part") then
print("Part is currently in the region")
else
print("Part is not in the region!")
Part.Position = OriginalPosition
end
end
end
There you have it!
If you have problems with the script, please reply. I'm home 99% of the time anyway [Joking]
All jokes aside; stay safe!
1 comment
Use Region3, I'm currently writing a script...