#Hover Script Inside Button Not Working Correctly

1 messages · Page 1 of 1 (latest)

plain forge
#

I just made this text button for my game , i inserted a hover script i have used before that worked correcly, but for some reason now it doesnt work as it should? please help

plain forge
# pine meteor

local button = script.Parent
local TweenService = game:GetService("TweenService")

-- Store original size
local originalSize = button.Size
local hoverSize = originalSize + UDim2.new(0.02, 0, 0.02, 0) -- 5% bigger

local tweenInfo = TweenInfo.new(
0.15,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
)

local growTween = TweenService:Create(button, tweenInfo, {Size = hoverSize})
local shrinkTween = TweenService:Create(button, tweenInfo, {Size = originalSize})

button.MouseEnter:Connect(function()
growTween:Play()
end)

button.MouseLeave:Connect(function()
shrinkTween:Play()
end)

mossy hatch
#

try printing on mouseenter and mouseleave

#

also js use uiscale and set anchorpoint to .5, .5

#

its much easier

plain forge
plain forge
mossy hatch
#

try adding a UIScale on your button

plain forge
#

ok i will but im not sure why i need it since its alr scaled

mossy hatch
#

cuz

#

its more reliable

plain forge
#

what do i scale it to

mossy hatch
#

i would say 1.1 is good

#

1.1 as big
1 as normal

plain forge
#

ok

#

problem not fixed tho hmm

mossy hatch
#

add a print("ENTER") and print("LEAVE") on your button.MouseEnter and button.MouseLeave for debugging

plain forge
#

i dont have those buttons?

mossy hatch
#

huh

plain forge
mossy hatch
#

oh

plain forge
mossy hatch
#

i thought it was a script problem

plain forge
#

is it not?

mossy hatch
#

no

plain forge
#

gui one then?

mossy hatch
#

go to property

#

do you see AnchorPoint?

#

set it to 0.5, 0.5

plain forge
#

done

mossy hatch
#

alright

#

you probably need to reposition your button

#

but

#

now

plain forge
#

oh ye

mossy hatch
#

show the size property of your textlabel

plain forge
#

i can still see its not working properly 😭

mossy hatch
#

oh yeah

#

just type 1 on that and press enter

#

so it sets the size to scale instead of pixel

#

{1, 0}, {1, 0}

plain forge
#

how do i make it so that the image and text get scaled too?

mossy hatch
#

show the size of button and imagelabel

plain forge
#

button

mossy hatch
#

use an autoscale plugin

lethal cobaltBOT
#

studio** You are now Level 8! **studio

mossy hatch
#

to turn the size into scale

#

i thought your button is already in scale based off the script 😭

plain forge
lethal cobaltBOT
#

studio** You are now Level 6! **studio

plain forge
mossy hatch
#

yes

plain forge
#

the scale text one?

mossy hatch
#

no

plain forge
#

is that the one i use

#

no it worked

mossy hatch
#

unit conversion

plain forge
#

it worked

mossy hatch
#

js set the size of ur button and image to scale, should be good

#

its important

#

so that it scales on other devices