How to make a shrinking border

As you know if you want to make a border you need to make it a union so players can walk inside so how could i make a border that shrinks and damages or warns if you ur outside it

I would do a giant invisible cylinder the size of the map with Beams being how the border is displayed (creating a transparent-wall visual on the sides on the cylinder)

Then, using either GetPartsInPart or

...
local function IsInCylinder(pos)
    if ((cylinder.Position-Vector3.new(0,cylinder.Position.Y,0))-(pos-Vector3.new(0,pos.Y,0))) > cylinder.Size.Y then
         return true
    else
         return false
    end
end
--(made into if statement to be understood better)

then using that function, i would run this function on the player’s HumanoidRootPart every second, if the function returns false, i damage them and give them the visuals for being outside of the border.

1 Like

I suggest using zoneplus instead of GetPartsInPart

although I feel like that code u made would probably be the best choice

wow the if statement looks really confusing

I would do something like what Panda and Arc suggested and then tween the size in the x and z direction doing something like:

part.Position = part.Position - vector3.new(1,0,1)