So, I want to make like a District System with Region3 and when you are going into a specific area, a GUI should pop up. It works, but, it keeps appearing after 5 seconds on the screen, which I don't want to. It's a local script. Anyone knows how to fix it? I've tried to do it with debounce too, but it didn't work.
local DistrictsWorkspace = game.Workspace:WaitForChild("Districts") local Found = false debounce = false while wait(1) do for i, v in pairs(DistrictsWorkspace:GetChildren()) do Found = false local region = Region3.new(v.Position - (v.Size/2), v.Position + (v.Size/2)) local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants()) for _, part in pairs(parts) do if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then print("Player was found!") Found = true break else Found = false print("Player wasn't found!") end end if Found == true then if game.Players.LocalPlayer.PlayerGui.Districts[v.Name].Enabled == true then game.Players.LocalPlayer.PlayerGui.Districts[v.Name].MainFrame.Visible = true wait(5) game.Players.LocalPlayer.PlayerGui.Districts[v.Name].MainFrame.Visible = false break end else game.Players.LocalPlayer.PlayerGui.Districts[v.Name].MainFrame.Visible = false end end end