local Regions = game.Workspace:WaitForChild("Region"):GetChildren()

local found = false local guirunned = false

while wait(1) do print("while loop running")

for i,v in pairs(Regions) do
	found = false
	local region = Region3.new(v.R1.Position, v.R2.Position)
	
	local parts = workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
	
	for _, part in pairs(parts) do
		print("For Loop Running")
		if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
			found = true
			break
		end	
	end
	
	if found == true then
		script.Parent.SoundRegion.NotInRegion:Stop()
		
		if script.Parent.SoundRegion[v.Name].IsPlaying == false then
			script.Parent.SoundRegion[v.Name]:Play()
			print(v.Name)
		end
		
		if guirunned == false then
			guirunned = true
			
			spawn (function()	
				
				script.Parent.Region.Frame.Place.Text = v.Name
				script.Parent.Region.Frame.Place.TextTransparency = 1
				script.Parent.Region.Frame.Visible = true
									
				repeat 
					script.Parent.Region.Frame.Place.TextTransparency = script.Parent.Region.Frame.Place.TextTransparency - 0.1
					wait(.1)
				until script.Parent.Region.Frame.Place.TextTransparency <= 0
								
				wait(3)
									
				repeat 
					script.Parent.Region.Frame.Place.TextTransparency = script.Parent.Region.Frame.Place.TextTransparency + 0.1
					wait(.1)
				until script.Parent.Region.Frame.Place.TextTransparency >= 1
									
				script.Parent.Region.Frame.Visible = false
			end)
		end
		
		break		
	else

		guirunned = false
		script.Parent.SoundRegion[v.Name]:Stop()
		print(v.Name)
		
		if script.Parent.SoundRegion.NotInRegion.IsPlaying == false then
			script.Parent.SoundRegion.NotInRegion:Play()	
		end

	end
end

end

1 comment

0

When I'm in 1 region the message appears "Jakku, Graveyard Of Giants" multiple time but doesn't happen when I'm in "Jakku, Niima Outpost"