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

why isnt a simple imagelabel change working?

I was working on a bigger problem and i noticed that my script was having problems changing a imagelabel.Image and also the text on a text label wouldnt change. I tried it out on a simplified version by just clicking a text button the gui imagelabel.Image would change but it isnt. I tried multiple ways of changing the image id from rbxassetid://862865537 to just 862865537 but it doesnt work. I know it is simple coding but i am just stumped on why its not working.

player = game.Players.LocalPlayer
local idi = "rbxassetid://862865537"
local slots = game.StarterGui.backpackgui.mainframe.Frameright



script.Parent.MouseButton1Click:Connect(function()
	
	slots.slot1.ImageLabel.Image = idi
	print("clicked")

	
	
end)

2 comments

0

Was your purpose of this to change the image that is currently visible on your PlayerGui?

0

its a imagelabel in a slot for the inventory and before i was trying to change the imagelabel from a table when something goes into my inventory but i was having problems and thought it was something else but now even when i just try to change the imagelabel in a simple format it still doesnt work.

4 answers

Wrong --> local slots = game.StarterGui.backpackgui.mainframe.Frameright

local player = game.Players.LocalPlayer
local idi = "rbxassetid://862865537"
local slots = player.PlayerGui.backpackgui.mainframe.Frameright

script.Parent.MouseButton1Click:Connect(function()
slots.slot1.ImageLabel.Image = idi
print("clicked")
end)

2 comments

0

says startergui is not valid member of player.

0

i gave u right script.

Wrong image format....

local idi = "rbxasset://textures/ui/yourimage.png" 

Note* It doesn't have to be PNG just needs to have the end of the file type.

Hope That Helped.

3 comments

0

i dont understand, if i just manually put in the code 862865537 in the imagelabel.Image it changes to rbxassetid://862865537 so what is this?

0

its supposed to do that

0

its supposed to do that

Still can't figure it out. Can you not change an imagelabel in the startergui with a simple localscript with filteringenabled? I have looked this up and many different time periods up to five years seem to be different like one is http://www.roblox.com/asset/?id3456436 or rbxgameasset://284402785" but none seem to work.

1 comment

0

Both of those adress should work. there must be something wrong with your script.

Simply you can't use StarterGui in order to change any property of a GUI in game. When you start a game it copies all the assets from the Starter Gui inside a player so you have to use PlayerGui from Player instance and if you are using a local script, the best way to do it is game:GetService("Players").LocalPlayer.PlayerGui

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