So at the bottom right of every player’s screen I want to make an effect where a frame pops up saying something like “You can’t afford this!”, but before it’s a notification I want it to tween in with a nice effect. I created a UIListLayout just for this, but apparently it sets the position automatically so that I can not tween it. Is there anything else I can do to make this?
I know I could script it manually, but I want to know if Roblox has built in functions or instances that would make my scripts a whole lot easier to work with.
I’m not too advanced in coding just yet sir, I don’t think I’d be able to make something so complex. Sure I can tween it on the bottom right corner, but if another notification has to pop up then the one that just tweened in has to move up and if another one pops up then i have to move both of them upwards, and it’s just hard to comprehend how I can do this.
I wanna say you solved this issue, but I’m well aware of that feature. What I want to know about is how can I do this manually, with my own ui. Is there another UILayout that allows me to tween positions?
Yeah, but if I do it that way then I have to manage every ‘NewNotification’ and tween one whenever another pops up, and it may become messy. But I think I could do this now that I’m actually considering it. I could probably make a function that does the tweening upwards part for me.
When a new notification is created, stop all the tweens for the current notifications, and set all of their tweens to position to the x position of where they should be, and then the y position to be their index times their size.
UDim2.new(x, 0, index * myAbsoluteSize, 0)
For the index thing, when a new notification is created, increment a variable, and set the index of the new notification to that, and when one is destroyed, shift the indexes for each notification down (and then retween and everything).
UI = script.Parent
MaxNotifications = 5
NotificationDuration = 2
function createNotification(NotificationText)
local Notifications = UI.Notifications:GetChildren()
if #Notifications >= MaxNotifications then
Notifications[1]:TweenPosition(UDim2.new(1.5, 0, Notifications[1].Position.Y.Scale, 0),"InOut","Linear",0.2,true);wait(0.2)
Notifications[1]:Destroy()
for i,v in pairs(Notifications) do if v ~= nil then
v:TweenPosition(UDim2.new(0.97, 0, v.Position.Y.Scale - 0.12, 0),"InOut","Linear",0.2,true)
end
end
local NewNotification = UI.NotificationTemplate:Clone()
NewNotification.Name = tostring(#Notifications+1)
NewNotification.Parent = UI.Notifications
NewNotification.Text.Text = NotificationText
NewNotification:TweenPosition(UDim2.new(0.97, 0, 0.85, 0),"InOut","Linear",0.2,true)
else
for i,v in pairs(Notifications) do
v:TweenPosition(UDim2.new(0.97, 0, v.Position.Y.Scale - 0.12, 0),"InOut","Linear",0.2,true)
end
local NewNotification = UI.NotificationTemplate:Clone()
NewNotification.Name = tostring(#Notifications+1)
NewNotification.Parent = UI.Notifications
NewNotification.Text.Text = NotificationText
NewNotification:TweenPosition(UDim2.new(0.97, 0, 0.85, 0),"InOut","Linear",0.2,true)
delay(NotificationDuration,function()
NewNotification:TweenPosition(UDim2.new(1.5, 0, NewNotification.Position.Y.Scale, 0),"InOut","Linear",0.2,true);wait(0.2)
NewNotification:Destroy()
end)
end
end
He wrote an entire thing, with a gui, and gave you the source code, and you say you “it was easy”, there was no “thank you” or any form of appreciation
Oh sorry if you felt attacked, it wasn’t meant to come across like that at all, just making sure credit and appreciation is given where needed,that’s all
Not taking any sides here, but please make sure to mark the topic as solved, either by yourself or @EpicMetatableMoment in order to prevent other replies!