I am finding a script on the dev form that I am modifying to make a notification popup, the problem is that I am touletmep of error messages that I do not know how to patch, that does not pose a problem except l when the event is spam or the system breaks
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CLIENT_Notification = ReplicatedStorage:WaitForChild("MSClient"):WaitForChild("Client_MSNotification")
local UI = script.Parent
local MaxNotifications = 4
local NotificationDuration = 4
function createNotification(TheTile,NotificationText)
local Notifications = UI.Notif:GetChildren()
script.NotificationPush:Play()
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
--pcall(function()
v:TweenPosition(UDim2.new(0.97, 0, v.Position.Y.Scale - 0.12, 0),"InOut","Linear",0.2,true)
--end)
end
end
local NewNotification = UI.NotificationTemp:Clone()
NewNotification.Name = tostring(#Notifications+1)
NewNotification.Parent = UI.Notif
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.NotificationTemp:Clone()
NewNotification.Name = tostring(#Notifications+1)
NewNotification.Parent = UI.Notif
NewNotification.Text.Text = NotificationText
NewNotification:TweenPosition(UDim2.new(0.97, 0, 0.85, 0),"InOut","Linear",0.2,true)
delay(NotificationDuration,function()
if NewNotification ~= nil then
--pcall(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)
end
end
-- Function Activator
CLIENT_Notification.OnClientEvent:Connect(createNotification)