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

How can i allow a player to change an image using both rbxassetid:// ids and website ids?

Asked by 2 years ago
Edited 2 years ago

i'm making one of those stupid "meme template" games where you change text/images and that kind of stuff, since i was bored, but i'm kind of stumped, i know how to incorporate usage of rbxassetid:// for images, but not for website urls, i tried this coding sample but it still only seems to work with rbxassetid://, any help?

function ChangeBG(BG)   
    local decal = set.Background.SurfaceGui.IMG -- rbxassetid image frame
    local decal2 = set.Background.SurfaceGui.IMG2 -- website url image frame

    if BG == "" then
        image = "rbxassetid://8761750143" -- the default rbxassetid image
        image2 = "https://www.roblox.com/library/8761750213" -- the default website url image
    else
        image = "rbxassetid://"..BG -- the user input rbxassetid image, works
        image2 = "http://www.roblox.com/asset/?id="..BG -- the user input website url, doesn't work
    end
    decal.Image = image -- these two lines change the image values, they both work
    decal2.Image = image2
end

say if i put 8697348913 (rbxasset id), it works and displays the image i want it to, but if i put 8697348957 (website id), it doesn't show anything, not even the rbxassetid image

i also tried using the url format i used for the default website url, it didn't work either, is there a specific way to convert website url to rbxassetid through scripts?

i'm genuinely lost and can't get this to work right, any help would be massively appreciated

0
is this in a local or server script? MendozaHM3SBulldog 32 — 2y

Answer this question