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?
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