I'm trying to make a shop gui that'll appear and disappear depending on if the player is in the correct area. The Gui appears when you enter the region, but won't go away. Script:
local RegionPart = workspace.GemTradeVisual
local Region = Region3.new(RegionPart.Position - (RegionPart.Size/2),RegionPart.Position + (RegionPart.Size/2))
local Detected = false
local Player = game:GetService("Players").LocalPlayer local Char = Player.Character or Player.CharacterAdded:Wait()
wait()
RegionPart:Destroy()
while wait(1) do
local Detect = workspace:FindPartsInRegion3WithWhiteList(Region,game.Players.LocalPlayer.Character:GetDescendants(),math.huge)
for _,v in pairs(Detect) do
if v.Parent.Name == Player.Name then
Detected = true
break
else
Detected = false
print(v)
end
end
if Detected then
Player.PlayerGui.SellGems.Enabled = true
else
Player.PlayerGui.SellGems.Enabled = false
end
end
