Region3 / GUI Help

Hey. I am trying to make it so when I enter a region, it will show a gui, and when exiting it will stop the gui from showing. I got here:

local Region = Region3.new(script.Parent.Position - (script.Parent.Size / 2), script.Parent.Position + (script.Parent.Size / 2))
local RunService = game:GetService("RunService")

while RunService.Stepped:Wait() do
	
	local PartsInRegion = workspace:FindPartsInRegion3(Region, script.Parent, math.huge)	
	
	for i,v in pairs(PartsInRegion) do
		
		if v.Parent:FindFirstChild("Humanoid") then
			
			
			
		end
		
	end
	
end

then when I thought about how I would code the rest I got stuck. Any help?

Howdy, Instead of trying to use Region3 just use ZonePlus you can find it here it allows you to easily create and manage zones like you’d like.

2 Likes

Don’t use plugins, you can do this yourself! Anyway, you were essentially nearly there.

local Region = Region3.new(script.Parent.Position - (script.Parent.Size / 2), script.Parent.Position + (script.Parent.Size / 2))
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

while RunService.Stepped:Wait() do
	local PartsInRegion = workspace:FindPartsInRegion3(Region, script.Parent, math.huge)	
	for i,v in pairs(PartsInRegion) do
		if v.Parent:FindFirstChild("Humanoid") and v.Name == "HumanoidRootPart" then
			local Player = Players:GetPlayerFromCharacter(v.Parent)
			local Frame = Player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("Frame")--change this line to fit your purpose
			if Frame.Visible == false then
				Frame.Visible = true
			end
		end
	end
end