Hello everyone,
I’m making a notification system and stumbled upon an issue.
in my notification UI they are supposed to be spaced like this:
they would be spaced like this if the function to create them doesn’t call them fast, However if the script is called fast then this occurs:
as you can see the spacing is almost non existent and I want them to be spaced like the first picture regardless of how fast the script is being called at
here is the script responsible for that:
local function ManageExessive(Player)
local LastFrame = 0
for i,v in ipairs(Player.PlayerGui.PopupUI.PopupFrame:GetChildren()) do
if v:IsA("Frame") then
local Tween = TweenService:Create(v,TweenInfo.new(0.05), {Position = v.Position - UDim2.fromScale(0,0.12)})
Tween:Play()
if v.Position.Y.Scale < 0 or v.Position.Y.Scale - 0.12 < 0 then
local Event
local Tween = TweenService:Create(v,Tweeninfo, {Size = v.Size - UDim2.fromScale(0.9,0), BackgroundTransparency = 1})
Tween:Play()
Event = Tween.Completed:Connect(function()
v:Destroy()
Event:Disconnect()
end)
end
end
end
end
local GuiFunction = {}
local function Showpopup(Player,TweenedUi,ExtraUI)
ManageExessive(Player)
local SizeTween = TweenService:Create(TweenedUi,Tweeninfo, {Size = TweenedUi.Size + UDim2.fromScale(0.9,0) , BackgroundTransparency = 0})
local StrokeTween = TweenService:Create(TweenedUi.UIStroke,Tweeninfo,{Thickness = 1})
local CloseTween = TweenService:Create(TweenedUi,Tweeninfo, {Size = TweenedUi.Size, BackgroundTransparency = 1 })
local StrokeCloseTween = TweenService:Create(TweenedUi.UIStroke,Tweeninfo,{Thickness = 0})
TweenedUi.Parent = Player.PlayerGui:WaitForChild("PopupUI").PopupFrame
SizeTween:Play()
StrokeTween:Play()
SizeTween.Completed:Wait()
for i,v in ipairs(ExtraUI) do
if v:IsA("UICorner") or v:IsA("UIStroke") then continue end
v.Visible = true
end
task.wait(2)
if TweenedUi.Parent ~= nil then
CloseTween:Play()
StrokeCloseTween:Play()
CloseTween.Completed:Wait()
TweenedUi:Destroy()
end
end
Let me know if you have any questions, thank you.