Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I add the Instance.new("ImageLabel") in this script?

I added the Instance.new("ImageLabel") in the script with the discriptions, but it didn't show them up. This is the script:

script.Parent:RemoveDefaultLoadingScreen()

local screen = Instance.new("ScreenGui")
screen.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
 
local imageLabel = Instance.new("ImageLabel")
imageLabel.Size = UDim2.new(1,0,1,0)
imageLabel.Image = "http://www.roblox.com/asset/?id=(NUMBER)" --Image Asset ID Number

local textLabel = Instance.new("TextLabel")
textLabel.Parent = screen
textLabel.Text = "Loading"
textLabel.Size = UDim2.new(1,0,1,0)
textLabel.FontSize = Enum.FontSize.Size14

local count = 0
while game.ContentProvider.RequestQueueSize > 0  do
	textLabel.Text = "Loading " .. string.rep(".",count)
	count = (count + 1) % 4
	wait(.3) 
end
 
screen.Parent = nil

3 comments

0

Maybe in Line 8. replace (NUMBER)

0

You're not parenting the image to the "screen". If you don't parent the image to the gui then it will not show up.

0

I just replace the ID number to (Number) so I don't show my decal and I see what you are saying M39

1 answer

Like what M39a9am3R said, the problem is that you don't have a parent for imageLabel.


Usually, when you don't set a parent, the object actually has a parent; and that parent is nil. If the parent is nil, you can still set the parent to anything like Workspace to Lighting, but only if it's a variable.

script.Parent:RemoveDefaultLoadingScreen()

local screen = Instance.new("ScreenGui")
screen.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

local imageLabel = Instance.new("ImageLabel")
imageLabel.Parent = screen
imageLabel.Size = UDim2.new(1,0,1,0)
imageLabel.Image = "http://www.roblox.com/asset/?id=(NUMBER)" --Image Asset ID Number

local textLabel = Instance.new("TextLabel")
textLabel.Parent = screen
textLabel.Text = "Loading"
textLabel.Size = UDim2.new(1,0,1,0)
textLabel.FontSize = Enum.FontSize.Size14

local count = 0
while game.ContentProvider.RequestQueueSize > 0  do
    textLabel.Text = "Loading " .. string.rep(".",count)
    count = (count + 1) % 4
    wait(.3) 
end

screen.Parent = nil

1 comment

0

The usually preferred method of setting a parent it to use the second argument of Instance.new. 'Instance.new("Part", workspace)'

This discussion is preserved as it was. New answers, comments, and votes are closed.