So I was writing a notifications system and I wanted to write a simple animation for it which is supposed to move the notification up each time when there are no notifications above it
But there is a problem: It either does not move the notification higher or it does but inaccurately
Here’s a video on how the problem looks like (Unfortunately I can’t find a video which would correlate with what I want):
Here’s the code which is responsible for moving the notifications up:
repeat task.wait()
until script.Parent.Name == "Notification"
local origCountOfNotifs = #script.Parent.Parent:GetChildren()
while task.wait(0.05) do
if origCountOfNotifs ~= #script.Parent.Parent:GetChildren() and script.Parent.Position.Y.Scale ~= 0 then
origCountOfNotifs = #script.Parent.Parent:GetChildren()
local canContinue = false
for _, v in ipairs(script.Parent.Parent:GetChildren()) do
if not v:IsA("Frame") or v.Name == "Placeholder" or v == script.Parent then continue end
if (v.Position.Y.Scale ~= script.Parent.Position.Y.Scale - 0.182) and script.Parent.Position.Y.Scale - 0.182 >= -0.001 then
canContinue = true
else
canContinue = false
break
end
end
if canContinue then
script.Parent.Position = UDim2.new(0.5, 0, script.Parent.Position.Y.Scale - 0.182, 15)
end
end
end
Any help would be appreciated