There is a lot of issues that may not be a problem now but they will be in the future, First is the Scaling, you are changing the offset instead of the scale: Udim2.new(ScaleX,OffsetX,ScaleY,OffsetY), this can cause users to have bad ui button placements, another issue is the tweening, you should just scale the Script.Parent button, since everything else inside of it will scale aswell.
“Click” should be used for what the button does. example: open the settings menu
“Down” play the tween to make it smaller
“Up” play the tween to make it normal again
i tried scaling the Button it self and everything was messed up
hopefully i understood what you meant
Also, why you have task.wait() with so low numbers like 0.1 or 0.01, unless you want some delay in it, you should just leave it empty or remove it entirely
So i should change
Button.MouseLeave:Connect(playTween2)
→ Button.MouseButton1Up:Connect(playTween2)
and
Button.MouseButton1Click:Connect(playTween3)
—> Button.MouseButton1Down:Connect(playTween3)
something like that?
Here a plugin to help with it!
Yes, but depending on the result you want you may have to use MouseEnter and MouseLeave
No make a player variable and get the Mouse
local TS = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local UiButton = script.Parent
UiButton.MouseEntered:Connect(function()
--Play the TweenService when the mouse hovers the Button
end
UiButton.MouseLeave:Connect(function()
--Reset the CFRAME of the Ui when the mouse is no longer on the UiButton
end
In your code you don’t actually use plrMouse
. Why is that?
Man, why does it have to get the mouse? It doesn’t make sense to me
Sorry that was a mistake but I fixed it.
This makes no sense, your script introduces nothing new. OP already had those event connections.
This is the exact code format used in all games if it does not work then Idk maybe he should make sure if it’s a Script or LocalScript
You’re not seeing what OP’s issue is. The issue is that the button doesn’t tween whenever they click on it.
Ohh ight thanks for identifying the issue to me my bad…
If you have trouble with it you can send me a copy of your ui in dm for me to help you
Make sure that the player is clicking the TextButton, not the ImageButton. I tried it out and realised that it was not even detecting the click. I moved the TextButton away from its descendants and it started detecting clicks.
but what about the design of the GUI?
worry about the design later. see if this is the issue first. you can just duplicate the gui and move the descendants away from the textbutton to test
you need to change the [“Size”] to just Size i think