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

Why wont this image button change when I mouse over?

Ok so I have a text label and an image button. When I mouse over the text label the image button should change to the specified decal. It should change once again when I leave.

I get print back, but it doesnt work. Any help is much appreciated.

For no reason whatsoever, it is wfj014's fault. Shame on you.

local ImageButton = game.Players.LocalPlayer.PlayerGui.Stuffiez.Background.Options.MapImage

script.Parent.MouseEnter:connect(function() --Sets up the function for when the mouse hovers over said GuiObject
ImageButton.Image = "rbxassetid://503430059" --Image here
print("Please dont dun break")
end) --Ends the function
script.Parent.MouseLeave:connect(function()
	ImageButton.Image = "rbxassetid://133293264"
	print("Please dont dun break#2")
end)

1 comment

0

Are you positive you have the correct IDs for the images?

1 answer

✓ Accepted answer

The problem is that StarterGui and PlayerGui are not the same.

You need to access the players gui:-

-- using a local script
local gui = game.Players.LocalPlayer.PlayerGui

You can also use .Parent to find the gui as this script seems to be in the gui.

I hope this helps, please comment if you need additional help resolving this.

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