How do i make a image changer

how do i make a gui button that makes the ImageLabel change when you add a code in it,
just like a music player gui but for a ImageLabel

Screenshot 2021-10-15 204910

1 Like

I will not be writing the whole code for you but I can give you an idea.

local Images = {0, 0, 0}
local Index = 1
--"Replace Time with the amount you want. Example: 1"
local Time = 1

while true do
    wait(Time)
    image.Image = Images[Index]
    if Index > Images then
        Index = 1
    end
end

Let me know if there are any errors. Mark as solution if it suits your need.

2 Likes

You can use coding to your advantage to make it work.

No but seriously you just make a GuiButton and connect a function to Activated or MouseButton1Click that changes an ImageLabel.Image

2 Likes

not sure how your post snuck in there I thought I was the second post, must be a graphical error

Anyway OP said he wanted code that when you click a button the image changes you just made an automatic slideshow for him.

The code would look something like:

guibutton.MouseButton1Click:Connect(function()
    ImageLabel.Image = "someimageid"
end)
1 Like

Oh woops, I misread the post, thought they just wanted it to cycle through a table. Hence them stating, “like a music player but for a ImageLabel”

2 Likes

this

i was talking about this music player gui

So you want to use that as a basis for an image changer? If so, does it require being shown only by the player or on the server too?

1 Like

only on the player it self will shown

btw this is the script i tried and it doesnt work

function OpenSong()
	local IDN = script.Parent.Parent.id.Text
	local Sound = script.Parent.Parent.image
	Sound.Image = 'rbxassetid://'.. IDN

end
script.Parent.MouseButton1Click:connect(OpenSong)

i put the localscript inside the input button

1 Like
local ChangeButton = "Location of button"
local Input = "Location of TextBox"
local ImageLabel = "Location of ImageLabel"

ChangeButton.MouseButton1Click:Connect(function()
	ImageLabel.Image = ("rbxassetid://"..Input.Text)
end)
1 Like

omg thank you so much, you save the rest of my Brian Cells

1 Like