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

Image Label extra images?

Asked by 6 years ago

FirstImage = "http://www.roblox.com/asset?id=" -- Put ID here SecondImage = "http://www.roblox.com/asset?id=" -- Put ID here

while true do script.Parent.Image = FirstImage

wait(4)

script.Parent.Image = SecondImage

wait(1) end i have the script here but i want to add more images how do i do that?

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Read this for learning how to make good questions!

You obvieusly know absolutely nothing about scripting, I doubt that the ids you pasted would work, because if you want an id to be changed with a script you need to use rbxassetid:// and then the id like this rbxassetid://924320031 do not put in the whole link as it might not work.

To answer your question it's pretty easy, the script works with a loop that keeps changing the image and waits 4 seconds so you'll just have to copy and paste some code

I'll give an example here. I'll make it so you only have to paste in the ID

local FirstImage = 924320031 -- Put ID here
local SecondImage = 924320031 -- Put ID here
local ThirdImage = 924320031 -- Put ID here
local FourthImage = 924320031 -- Put ID here

local im = script.Parent -- Don't change this if you have your script inside the image

local waitTime = 4 -- How long you want to wait between changing images

repeat
    im.Image = 'rbxassetid://'..FirstImage
    wait(waitTime)

    im.Image = 'rbxassetid://'..SecondImage
    wait(waitTime)

    im.Image = 'rbxassetid://'..ThirdImage
    wait(waitTime)

    im.Image = 'rbxassetid://'..FourthImage
    wait(waitTime)

until false
0
1) where I say put ID here I mean that you have to change the 924320031 with your id 2) please set this as 'best answer' lol User#20388 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

This can be accomplished using tables and loops (which you are already doing to an extent). Specifically while and for loops. To add another image, add another image id to the ImageIDS table. Make sure to use the same format as the current ids are.

Solution:

local ContentProvider = game:GetService("ContentProvider")

local ImageIDS = {"rbxassetid://id1", "rbxassetid://id2", "rbxassetid://id3", "rbxassetid://id4"}
ContentProvider:PreloadAsync(ImageIDS)

while wait(1) do
    for _,ImageID in pairs(ImageIDS) do
        script.Parent.Image = ImageID
        wait(4)
    end
end

Solution without ContentProvider:

local ImageIDS = {id1, id2, id3, id4}

while wait(1) do
    for _,ImageID in pairs(ImageIDS) do
        script.Parent.Image = "rbxassetid://" .. ImageID
        wait(4)
    end
end

The while loop waits 1 second before running. It will wait until the for loop is done before starting again. The for loop goes through your list of images and sets the image. It then waits 4 seconds before continuing.

In the first solution I am using the "ContentProvider" service to preload images. This means that you will have to fill your table with images instead of ids. In the second solution this isn't necessary, but your images may not load.

To get an image from an id you can (in Roblox Studio):

Create a decal.

Put your id in the "Texture" section of the decal.

Hit enter

The id should be replaced with an image id.

This is the best method afaik for getting images. Someone can correct me on that.

0
If you know rbxassetid:// you can type it faster then you can paste it lol User#20388 0 — 6y
0
Thanks! OnDaLoos11 0 — 6y

Answer this question