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

why isnt a simple imagelabel change working?

Asked by 5 years ago
Edited 5 years ago

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)
0
Was your purpose of this to change the image that is currently visible on your PlayerGui? BloxRoxe 109 — 5y
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. Silvanatri 24 — 5y

4 answers

Log in to vote
1
Answered by
G2001H 75
5 years ago
Edited 5 years ago

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)
0
says startergui is not valid member of player. Silvanatri 24 — 5y
0
i gave u right script. G2001H 75 — 5y
Ad
Log in to vote
0
Answered by
Farsalis 369 Moderation Voter
5 years ago

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.

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? Silvanatri 24 — 5y
0
its supposed to do that speedyfox66 237 — 5y
0
its supposed to do that speedyfox66 237 — 5y
Log in to vote
0
Answered by 5 years ago

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.

0
Both of those adress should work. there must be something wrong with your script. ScuffedAI 435 — 5y
Log in to vote
0
Answered by 5 years ago

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

Answer this question