I’m working on a notification system and I want to make pretty much an animated UIListLayout so when a new notification comes in everything in the frame moves down the right amount.
I’ve tried this:
script.Parent.MouseButton1Click:Connect(function()
local clone = script.Parent.Frame:Clone()
for i, v in pairs(script.Parent.Parent.Frame:GetChildren()) do
local success, err = pcall(function()
local position = UDim2.new(v.Position.Y.Scale + clone.Size.Y.Scale, 0, 0, 0)
v:TweenPosition(UDim2.new(position), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.5, true)
end)
if err then
error(err)
end
end
clone.Visible = true
clone.Parent = script.Parent.Parent.Frame
end)
But it hasn’t been working and no errors have come from the pcall.
Any help is appreciated.
The child’s position, which’s controlled by UIListLayout, can’t be adjusted from a script. If you’re wanting to create an animated frame, you’d need to do it separately (remove UIListLayout) - manually sorting them out to their corresponding place.
Here is what I have
Currently, as in the script, I’m duplicating the frame ScreenGui.Notify.Frame then moving it to the Notification holder ScreenGui.NotificationHolder then I’m moving everything in the Notification holder down the size of the notification ScreenGui.Notify.Frame then parenting it to the notification holder.
Alright, I presume this is the final product that you require:
local button = script.Parent; local holder = button.Parent.NotificationHolder
local ts = game:GetService("TweenService")
button.Activated:Connect(function()
local clone = button.Frame:Clone()
for _, i in pairs(holder:GetChildren()) do
local pos = UDim2.fromScale(0, i.Position.Y.Scale + .224)
local tween = ts:Create(i, TweenInfo.new(.5, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut, 0, false, 0), {Position = pos})
tween:Play()
end
clone.Visible = true; clone.Parent = holder
end)
kept it clean and organised, hence should be good to go. If there’s any changes you want me to do, let me know - otherwise you’d acknowledge how to fix them.