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

how do i change the imgid on a imagelabel?

so for the past half hour iv been trying to change the imgid on a imagelabel but it changes the imgid when it sets it and nothing shows up. i can change it manualy and it shows it but wheni try to do it through a script it changes the image id and doesent work. ill leave my script below to see if im doing it wrong or something.

line 23-28 is where im trying to change it

--vars go here
local playerinvs = game.ReplicatedStorage.PlayerInvs

local playerinv = game.ReplicatedStorage.PlayerInvs


--find out when the player joins..
game.Players.PlayerAdded:Connect(function(p)
	
	local playerinvfolder = Instance.new("Folder")
	playerinvfolder.Name = p.Name.."sInv"
	playerinvfolder.Parent = playerinv
	
	for i=1, 9 do
		local a = Instance.new("Folder",playerinvfolder)
		a.Name = "Slot"..i
		local b = Instance.new("BoolValue",a)
		b.Name = "IsFull"
		b.Value = false
		a.ChildAdded:Connect(function(item)  -- surprised this works but this will tell me when somone picks up something
			 -- saved me about 20 lines of code right here
			wait(0.5)
			local nameid = a.ItemName.Value
			local pictureid = a.ItemName.PID.Value
			print(pictureid)
			local slot =  p.PlayerGui.InvGui.Frame:FindFirstChild(i)
			slot.Image = pictureid
			print(slot.Image)
		end)
	end
	
	
end)



--make a for loop and create 12 diffrent folders for each slot

--make sure its easy to add more to later on

2 comments

0

What do both print statement print out?

0

they both print out the changed numberid

1 answer

Just simply add “rbxassetid://“ before the numbers. That should fix it.

Line 27 would be something like this:

slot.Image = “rbxassetid://“..pictureid 

This will add “rbxassetid://“ before the picture id you put.

3 comments

0

Hey. Denny you know your stuff xD

0

the img id aready passes string with the img id in it

0

^ So you’re saying you already have “rbxassetid://“ on it yet it still won’t work? If so, subtract the value by one, two, or three and maybe it’ll work. If that doesn’t help, can you reword what you said?

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