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

The image label in this script only shows one of the two image labels I have created. Why is that?

Asked by 9 years ago

Goulstem helped in the making of this.

--ContentProvider service
local content = game:GetService('ContentProvider')

--Put your images into a table
local images = {
    "http://www.roblox.com/asset/?id=265610173"

   }

--Load the images, from the table
for _,v in next,images do
    content:Preload(v)
end

--ContentProvider service
local content = game:GetService('ContentProvider')

--Put your images into a table
local images = {
    "http://www.roblox.com/asset/?id=265610212"

   }

--Load the images, from the table
for _,b in next,images do
    content:Preload(b)
end

--Your Code
script.Parent:RemoveDefaultLoadingScreen()

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

local frame = Instance.new("Frame")
frame.Parent = screen
frame.Size = UDim2.new(1,0,1,0)
frame.BackgroundColor3 = Color3.new(0,0,0)
frame.Transparency = 1

local textlabel = Instance.new("TextLabel")
textlabel.Parent = screen
textlabel.BackgroundColor3 = Color3.new(255,255,255)
textlabel.BackgroundTransparency = 1
textlabel.Transparency = 1
textlabel.Position = UDim2.new(.4,0,0.65,0)
textlabel.Size = UDim2.new(0.25,0,0.1,0)
textlabel.Font = "Legacy"
textlabel.FontSize = "Size24"
textlabel.Text = "Im all fired up!"
textlabel.TextColor3 = Color3.new(0,0,255)
textlabel.TextScaled = true
textlabel.TextWrapped = true
textlabel.TextXAlignment = "Center"
textlabel.TextYAlignment = "Center"

local imagelabel = Instance.new("ImageLabel") 
imagelabel.Parent = frame
imagelabel.Size = UDim2.new(0.5,0,1,0)
imagelabel.ZIndex = 1
imagelabel.Position = UDim2.new(0,0,0,0)

local imagelabel1 = Instance.new("ImageLabel") 
imagelabel.Parent = frame
imagelabel.Size = UDim2.new(0.5,0,1,0)
imagelabel.ZIndex = 1
imagelabel.Position = UDim2.new(0.5,0,0,0)

--Iterate through table
for i,v in ipairs(images) do --ipairs iterates in order
    imagelabel.Image = v
end

--Iterate through table
for i,b in ipairs(images) do --ipairs iterates in order
    imagelabel.Image = b
end

local count = 0
while game.ContentProvider.RequestQueueSize > 0  do
    textlabel.Text = "I'm all fired up!" .. string.rep(".",count)
    count = (count + 1) % 4
    wait(10) 
end

screen.Parent = nil
``````

My goal for this script is to make it show two image labels so the two decals I made can come together. An error I have is

23:38:01.026 - ReplicatedFirst.Loading Screen:67: bad argument #3 to 'Image' (string expected, got nil)

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

In the future, give credit please.

You're overwriting the images table, rather than just adding another index to it. This is causing oly the overwitten image to display. Also, you're re-writing mutliple sections of code. Just put both your images in the initial images table.

--ContentProvider service
local content = game:GetService('ContentProvider')

--Put your images into a table
local images = {
    "http://www.roblox.com/asset/?id=265610173",
    "http://www.roblox.com/asset/?id=265610212"
}

--Load the images, from the table
for _,v in next,images do
    content:Preload(v)
end

--Your Code
script.Parent:RemoveDefaultLoadingScreen()

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

local frame = Instance.new("Frame")
frame.Parent = screen
frame.Size = UDim2.new(1,0,1,0)
frame.BackgroundColor3 = Color3.new(0,0,0)
frame.Transparency = 1

local textlabel = Instance.new("TextLabel")
textlabel.Parent = screen
textlabel.BackgroundColor3 = Color3.new(255,255,255)
textlabel.BackgroundTransparency = 1
textlabel.Transparency = 1
textlabel.Position = UDim2.new(.4,0,0.65,0)
textlabel.Size = UDim2.new(0.25,0,0.1,0)
textlabel.Font = "Legacy"
textlabel.FontSize = "Size24"
textlabel.Text = "Im all fired up!"
textlabel.TextColor3 = Color3.new(0,0,255)
textlabel.TextScaled = true
textlabel.TextWrapped = true
textlabel.TextXAlignment = "Center"
textlabel.TextYAlignment = "Center"

local imagelabel = Instance.new("ImageLabel") 
imagelabel.Parent = frame
imagelabel.Size = UDim2.new(0.5,0,1,0)
imagelabel.ZIndex = 1
imagelabel.Position = UDim2.new(0,0,0,0)

local imagelabel1 = Instance.new("ImageLabel") 
imagelabel.Parent = frame
imagelabel.Size = UDim2.new(0.5,0,1,0)
imagelabel.ZIndex = 1
imagelabel.Position = UDim2.new(0.5,0,0,0)

--Iterate through table
for i,v in ipairs(images) do --ipairs iterates in order
    imagelabel.Image = v
end

--Iterate through table
for i,b in ipairs(images) do --ipairs iterates in order
    imagelabel.Image = b
end

local count = 0

while game.ContentProvider.RequestQueueSize > 0  do
    textlabel.Text = "I'm all fired up!" .. string.rep(".",count)
    count = (count + 1) % 4
    wait(10) 
end

screen.Parent = nil
0
It still shows only 1 image label Relampago1204 73 — 9y
1
Line 50-53 should have a 1. woodengop 1134 — 9y
Ad

Answer this question