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

Issues experimenting with Image Button and the image that is displayed; Possibly inoperable?

Asked by 6 years ago

Greetings to all. While I am normally able to solve minor problems on a self-taught routine, I have accrued many open questions as to why the concept of using Image Buttons isn't able to work for me at the present.

The primary purpose of my game interface(Referring to GUI's Henceforth) is to undergo a change of what image is displayed on the ImageButton Object upon mouse over. It had worked well with the default interface scripts, but something opened up not much later.

Firstly, even after all [possible(I say such due to me being a tyro, or beginner with coding)] variable declarations, Image resizing and centering methods, and checking if properties are not changed upon the image change step, The button image simply disappears and can not be reclaimed no matter what code I use to change the image once or many times more.

Now, the main point I had wished to address is that I require insight as to what code can be added or changed to a script to help resolve such a vexing issue.

local MDSettingButton = script.Parent

MDSettingButton.Image = 'rbxassetid://1462236742'

Whenever trying to do anything at all after that code has run, the image button does not respond and is invisible. Every object and script placed within it works as desired, as a side factor.

Bewildered; I went on about things that could have been the solution, such as: "Perhaps the Image Button's Image position is reset somewhere off-screen upon change? Perhaps I have to set something else true or false to the properties?"

Once again, I am essentially new with coding concepts, and keep in mind that I have already supplied High-Definition Buttons that are centered perfectly and have no conflict mechanically. I simply wish to learn something new and be able to use it with less help every time I succeed with it.

0
I believe that the Asset Id of the ImageButton is not the ID of a Decal Texture, but rather to a game, and due to that reasoning, the game simply does not recognise it as an image, so therefore, it leaves the Image Button blank, which, as far as I can see, is the cause of the scripting problem. UgOsMiLy 1074 — 6y

1 answer

Log in to vote
0
Answered by
ax_gold 360 Moderation Voter
6 years ago

Roblox doesn't like to load in asset ids unless they're already preloaded into the game. you can always make a decal and insert it into the script, change the Decal texture to your image, then change the script to something like this:

local MDSettingButton = script.Parent

MDSettingButton.Image = script.Decal.Texture
0
Very well. With your method of creating a pre-loaded decal containing the texture file then placed inside the script, I managed to make the whole purpose of the MouseEnter/Leave event work. Thank you deeply. :) KittenishMomo 4 — 6y
Ad

Answer this question