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 make an imageGUI change image when I scroll over it?

For example; I have this as an image gui http://www.roblox.com/SCROLLDOWN-item?id=265733519

when I scroll over it I want it to turn to this; http://www.roblox.com/scroll-down-select-item?id=265733452

Edit1; Yes, I mean scroll over it. The gui events page mean absolutely nothing to me, i've seen it but no idea what any of it means.

Edit2; Read http://wiki.roblox.com/index.php?title=API:Class/GuiObject/MouseEnter This still doesnt help me, I only know very very basic scripting, what would I do with that script? After GuiObject.MouseEnter:connect(function(x, y) what would I put?

3 comments

0

Scroll over it? Meaning hover over it?

0

Always do your research! If you took a look and a GUI's events on the wiki, there are a couple that suit just this purpose!

2 answers

Dude, this is simple. To simple. First off, learn the proper asset ID's, not the URL's, and then learn how to use functions, as in

script.Parent.MouseEnter:connect(function()
--code here.
end)

1 comment

0

believe me, the wiki is your friend. Use the cookbook especially, it explains a lot.

This is what you should do:

script.Parent.MouseEnter:connect(function()
	script.Parent.Image = 'rbxassetid://265733452'
end)
script.Parent.MouseLeave:connect(function()
	script.Parent.Image = 'rbxassetid://265733519'
end)

Please note: This code is only tested with ImageLabels, but it should work. You just need to change "Image" to the name of the image property on the object.

2 comments

0

Image property? As in the name as the decal or whatever the imagelabel is called? And what script would this be? Local script or just a normal one? Would the script go inside the imagelabel?

0

ImageLabels have a property called "Image" (Property Browser > [image label object] > Image > Image). The script would go inside of the imagelabel, and it can be a LocalScript. It goes inside the imagelabel so that way "script.Parent" returns the ImageLabel.

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