Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does the Images Dissapear?


local plr = game.Players.LocalPlayer
local hatcontent = plr.PlayerGui.Custom.LeftFrame.Content.HatContent

local hatids = { 
["ImageButton1"] = "http://www.roblox.com/asset/?id=396889219", 
["ImageButton2"] = "http://www.roblox.com/asset/?id=396894473",
["ImageButton3"] = "http://www.roblox.com/asset/?id=396894634",
["ImageButton4"] = "http://www.roblox.com/asset/?id=396905469",
["ImageButton5"] = "http://www.roblox.com/asset/?id=396905566",
["ImageButton6"] = "http://www.roblox.com/asset/?id=396905630",
["ImageButton7"] = "http://www.roblox.com/asset/?id=396905693",
["ImageButton8"] = "http://www.roblox.com/asset/?id=396947042",
["ImageButton9"] = "http://www.roblox.com/asset/?id=396947214",
["ImageButton10"] = "http://www.roblox.com/asset/?id=396950228"

}

for index, child in pairs(hatcontent:GetChildren()) do
	if hatids[child.Name] ~= nil then
		child.Image = hatids[child.Name]
	end
end

The images dissapear when you press Next Page, Previous Page, they just dissapear:

https://gyazo.com/44b790d5854bf8b61abd99cb5da2a794

Next button script:

nextbutton.MouseButton1Down:connect(function()
	
	hatframe1.Visible = false
	previousbutton.Visible = true
	hatframe2.Visible = true
	page.Text = "2/2"	
	
end)

Previous button script:

previousbutton.MouseButton1Down:connect(function()
	
	hatframe2.Visible = false
	hatframe1.Visible = true
	page.Text = "1/2"
	previousbutton.Visible = false	
	
end)

1 answer

✓ Accepted answer

The problem here is that those are not the asset urls you use to get images from studio. To get an asset from ROBLOX in studio, you have to use the following string:

local id = 0000
local url = "rbxassetid://" ..id

-- or

local url = "rbxassetid://0000"

-- etc.

I take it there are no other problems with your code. They all look fine.

Hope I helped!

~TDP

2 comments

0

False. His will work.

0

I fixed it by myself, and mine works fine. Anyways, +1 for trying to help me!

This discussion is preserved as it was. New answers, comments, and votes are closed.