Problem with ImageLabel

I encountered the following problem: I insert an image through a script, but when a notification arrives, there is nothing in the picture, although the id of the picture is inserted into the imageLabel itself without problems and the picture is also uploaded to the account.

--local script
local Player = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Notifications = require(script.Parent:WaitForChild("NotificationsHandler"))
local Notification_Event = ReplicatedStorage:WaitForChild("EventControllers"):WaitForChild("Message")

Notification_Event.OnClientEvent:Connect(function(NameTitle, Title, Time, icon)
	Notifications.new(NameTitle, Title, icon, Time)
end)
--module script
local Notifications_Frame = script.Parent.Parent:WaitForChild("Interface").Notifications
local Notifications = {}

Notifications.new = function(NameTitle, Title, Time, icon)
	local Notification = script.NotificationFrame:Clone()
	Notification.NameTitle.Text = NameTitle
	Notification.Title.Text = Title
	Notification.Icon.Image = "rbxassetid://"..icon
	Notification.Parent = Notifications_Frame
	Notification:TweenSize(UDim2.new(0.915, 0,0.104, 0), "Out", "Linear", 0.3, true)
	task.wait(Time)
	Notification:TweenSize(UDim2.new(0.915, 0,0, 0), "In", "Linear", 0.3, true)
	task.wait(0.4)
	Notification:Destroy()
	return Notification
end

return Notifications
--fire server
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local NotificationS_Event = ReplicatedStorage:WaitForChild("EventControllers"):WaitForChild("Message")
NotificationS_Event:FireClient(plr, "Test", "Testing", 16779530490, 7)
1 Like

Looks like you’re mixing up Time and icon

1 Like

Try this:

--module script
local Notifications_Frame = script.Parent.Parent:WaitForChild("Interface").Notifications
local Notifications = {}

Notifications.new = function(NameTitle, Title, Time, icon)
    local Notification = script.NotificationFrame:Clone()
    Notification.NameTitle.Text = NameTitle
    Notification.Title.Text = Title
    
    -- Check if 'icon' is a valid number and prepend 'rbxassetid://' if it's not already there
    local iconId = tonumber(icon) and "rbxassetid://"..icon or icon
    if not string.match(iconId, "^rbxassetid://") then
        iconId = "rbxassetid://"..iconId
    end
    
    Notification.Icon.Image = iconId
    Notification.Parent = Notifications_Frame
    Notification:TweenSize(UDim2.new(0.915, 0,0.104, 0), "Out", "Linear", 0.3, true)
    task.wait(Time)
    Notification:TweenSize(UDim2.new(0.915, 0,0, 0), "In", "Linear", 0.3, true)
    task.wait(0.4)
    Notification:Destroy()
    return Notification
end

return Notifications