Flickering Images when updating image

Hello! I’ve decided to start implementing my GUI today but when I change the image on the image buttons there appears to be a flickering. I’m unsure where this is coming from. Any help would be much appreciated.

https://gyazo.com/2787155fcbfdf8d95dee18bf9175d9cf

local button = script.Parent

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out) --you can set that to anything you want
local tIn = {Size = UDim2.new(0, 490,0, 105)} --glow color
local tOut = {Size = UDim2.new(0, 470,0, 100)} --start color
local createIn = ts:Create(button, ti, tIn) --when mouse ENTERS button
local createOut = ts:Create(button, ti, tOut) --when mouse LEAVES button

button.MouseEnter:Connect(function()
	script.Parent.Image = "rbxgameasset://Images/begin_active (1)"
	createIn:Play()

end)

button.MouseLeave:Connect(function()
	script.Parent.Image = "rbxgameasset://Images/begin_deactive (1)"
	createOut:Play()
end)

No, It’s repetitive even after letting the game run for a bit. If it’s the engine it’s kind of annoying.

Try preloading the assets beforehand and grab the IDs instead of the file names and see if that fixes it. It may be because its trying to grab the file directly from the game over and over again each time you hover on and off of it.

I went ahead and added to image labels to the button and hid them. I set them to the images I wanted and called them in the function when the mouse enters and leaves etc but Im still getting the same result.

How would I go about “pre-loading” the asset. I tried just entering “rbxassetid://5158840906” etc, but the images just end up disappearing.

Image Buttons also have a useful property:

1 Like

And the savior has been found! Thank you very much for telling me about this!

2 Likes