I have a script, that detects the region you are in with a folder with all the region parts and plays a small tween gui animation when entering that specific region. The problem is that the gui animation repeats endlessly until exiting it, how could I make it happen once? Here is the script
``local Regions = game.Workspace.Regions
local line = script.Parent.Line
local zoneName = script.Parent.ClippedTextTop.ZoneName
local subLevel = script.Parent.ClippedTextBottom.SubLevel
local number = script.Parent.ClippedTextBottom.Number
local found = false
local debounce = true
while wait(1) do
for i, v in pairs(Regions: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 Located")
found = true
break
else
found = false
print("Player Not Found")
end
end
if found == true then
wait(2)
script.Parent.Parent.FloorLevelGui.Enabled = true
line:TweenSize(UDim2.new(0.1, 200, 0, 1), "Out", "Quad", 0.7)
wait(0.5)
zoneName:TweenPosition(UDim2.new(0.217, 0, 0.350, 0), "Out", "Quad", 0.5)
wait(0.4)
subLevel:TweenPosition(UDim2.new(0.17, 0, -0.18, 0), "Out", "Quad", 0.5)
wait(0.1)
number:TweenPosition(UDim2.new(0.426, 0 ,-0.18, 0), "Out", "Quad", 0.5)
wait(5)
zoneName:TweenPosition(UDim2.new(0.217, 0, 0.8, 0), "Out", "Quad", 0.6)
wait(0.4)
subLevel:TweenPosition(UDim2.new(0.17, 0, -0.7, 0), "Out", "Quad", 0.6)
wait(0.1)
number:TweenPosition(UDim2.new(0.426, 0, -0.7, 0), "Out", "Quad", 0.6)
wait(0.4)
line:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Sine", 0.7)
wait(0.8)
script.Parent.Parent.FloorLevelGui.Enabled = false
end
end
end
``