Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 9 years ago

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
0
Maybe in Line 8. replace (NUMBER) fahmisack123 385 — 9y
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. M39a9am3R 3210 — 9y
0
I just replace the ID number to (Number) so I don't show my decal and I see what you are saying M39 User#5689 -1 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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

0
The usually preferred method of setting a parent it to use the second argument of Instance.new. 'Instance.new("Part", workspace)' Perci1 4988 — 9y
Ad

Answer this question