Hey there! I’m currently trying to make a GUI Notification module, I will open-source it once it is finished. I am running into an issue though. I cannot create a new UI element, but I can create a ScreenGui. Let me show the code.
NotifyFunctions.CreateServerNotification = function(ignore, text, font)
print(text)
print(font)
--//For Loop to Get all Players' GUI\\--
for i, v in ipairs(game.Players:GetChildren()) do
local GUI = v:WaitForChild("PlayerGui")
local NotifyGUI = GUI:FindFirstChild("Notifications")--Have to use :FindFirstChild() to see if we need to create a new one
print(NotifyGUI)
if NotifyGUI == nil then
local NotifyGUI = Instance.new("ScreenGui", GUI)
NotifyGUI.Name = "Notifications"
end
--//Making GUI\\--
print("Making")
local notification = Instance.new("TextLabel", NotifyGUI)
--//Editing Properties\\--
notification.Text = tostring(text)
notification.Font = font
end
end
Basically what’s happening here is I’m getting the text fired, and I loop through all the players to see if they have a certain GUI, and if not I create a new one. That works. After that, I tried to clone a TextLabel parented to the Module. That did nothing, so I tried running Instance.new()
. That does nothing in the output as well as nothing to the game. Does anyone know why? Any help is appreciated!