Hello developers!
Recently I’ve begun a project, and I’ve been trying to create a controllable “Slideshow” within my game, using Surface GUIs, ImageLabels & GUI Buttons. I’ve tried using some of my poor scripting skills, combined with some online sources and help from others, and I’ve got some sort of result, which doesn’t exactly work.
I’ve started by setting up my Board/Slideshow Holder and added all necessary objects.
They all together look something like this in-game: (Crappy, but will be designed to look later on:)
Now to the fun part, I’d guess?
When I test the game, the board of course doesn’t work. (As usual)
The Decal Placeholder disappears, and a blank white decal appears instead. I tried debugging the code by using print
statements, and when I looked in the output menu, the script run once, and never again, even after pressing the buttons.
This is the script:
Script
local images = {12141481317, 12141440428, 12141490287}
local currentImage = 1
local imageLabel = script.Parent.Parent.ImageLabel
local nextButton = script.Parent.NextButton
local prevButton = script.Parent.PrevButton
print("#1")
function updateImage(index)
imageLabel.Image = images[index]
end
print("#2")
nextButton.MouseButton1Click:Connect(function()
currentImage = currentImage + 1
if currentImage > #images then
currentImage = 1
end
updateImage(currentImage)
end)
print("#3")
prevButton.MouseButton1Click:Connect(function()
currentImage = currentImage - 1
if currentImage < 1 then
currentImage = #images
end
updateImage(currentImage)
end)
print("#4")
updateImage(currentImage)
print("#5")
Well, that’s pretty much it. I’d love if anybody could assist by pointing out what’s wrong with the script, as a major part of it was made by an AI, and a couple of my friends, and all of us don’t have a big clue of what we are doing.
Thank you for reading, and for any help in advance!