Mouseenter and mouseleave not working

Hello. I have a gui with buttons that are not becoming visible after I hover over them. I have a localscript here: script.Parent.MouseEnter:Connect(function()
script.Parent.Visible = true
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.Visible = false
end)

I have a video as well but the main thing is, MouseEnter isn’t making the gui show up. I don’t understand why this is the case, because this code is literally what everyone uses when they want to make a gui button hover. I’ve tried multiple solutions like making it invisible when I play the game, but nothing seems to be working.
Screen Recording.wmv (4.3 MB)

use ``` for codes
example:

print("IM A DEVFORUM USER!")

I don’t understand what you mean.

script.Parent.Visible = true
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.Visible = false
end)

I just tried this out but it didn’t work.

anyways is there errors in console

There aren’t any errors in the console

i tried ur script and it worked
(whoops wait)

print("LOAD")
script.Parent.MouseEnter:Connect(function()
	script.Parent.Visible = true
	print("GONE")
end)
script.Parent.MouseLeave:Connect(function()
	script.Parent.Visible = false
	print("UNGONE")
end)

I tried restarting studio but it didn’t work either. I also tried your solution but it didn’t work

new code

wait(1)
local oldtrans
oldtrans = script.Parent.Transparency
print("LOAD")
script.Parent.MouseEnter:Connect(function()
	print("GONE")
	script.Parent.Transparency = 1
end)
script.Parent.MouseLeave:Connect(function()
	print("UNGONE")
	script.Parent.Transparency = oldtrans
end)

I found out a solution. Apparently this must have been due to how imagebuttons work. When I duplicated a textbutton on top of it and changed the code, it worked somehow.