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

How to make an Image Label the image of a hat or model?

Asked by
Bman8765 270 Moderation Voter
10 years ago

Okay so I have a script in a screen gui that basically manages 3 buttons. The leftarrow button, the rightarrow button, and the mainbutton. This script's main intentions is to allow players to select from a variety of hats. The problem is I want an image of the hat to appear when the user is on that current hat and I don't know how to get an image of the hat or model and have the imagelabel show it? The current code I have basically makes it so when you click the arrow textbutton it will change the info that shows up, nothing to complicated... the code is not really important though I just need to know how I convert the image found on catalog for an item into something an imagelabel will like!

The code (again not really needed for you to answer the question):

--------------------------------------------------------------------
-- Hat Table, add and remove as pleased
--------------------------------------------------------------------
hats = {"http://roblox.com/asset/?id=83284634", "http://www.roblox.com/asset/?id=122210163"}
hatinfo = {"Some hat", "hat 2"}
hatimage = {"blah I need help", "right here"}
--------------------------------------------------------------------
-- Global Variables
--------------------------------------------------------------------
leftarrow = script.Parent.ArrowLeft
rightarrow = script.Parent.ArrowRight
currenthat = script.Parent.CurrentHat
page = 1
--------------------------------------------------------------------
-- Change Info Script
--------------------------------------------------------------------
function changeinfo()
    currenthat.Text = hatinfo[page]
    print(page)
end
changeinfo()
--------------------------------------------------------------------
-- Arrow Functions
--------------------------------------------------------------------
function ClickedLeft()
    if page >= #hats then
        page = 1
    elseif page <= #hats then
        if page ~= 1 then
            page = page -1
        elseif page == 1 then
            page = #hats
        end
    end
    changeinfo(page)
end

function ClickedRight()
    if page >= #hats then
        page = 1
    elseif page <= #hats then
        page = page +1
    end
    changeinfo(page)
end

leftarrow.MouseButton1Down:connect(ClickedLeft)
rightarrow.MouseButton1Down:connect(ClickedRight)

1 answer

Log in to vote
0
Answered by 10 years ago

ImageLabel.Image = 'http://www.roblox.com/Thumbs/Asset.ashx?format=png&assetId=' .. itemId

0
Not working Bman8765 270 — 10y
Ad

Answer this question