local Button1 = script.Parent.Defense -- I'm programming this button so far
local Button2 = script.Parent.Buildings
local Button3 = script.Parent.Traps
local Button4 = script.Parent.Robux -- lol, it aint giving bobux
local Desc = script.Parent.Desc
local Debounce = false
local SizeGoal = UDim2.new(0,170,0,140)
local SizeReturn = UDim2.new(0,150,0,120)
Button1.MouseEnter:Connect(function()
if not Debounce then
Debounce = true
Button1:TweenSizeAndPosition(SizeGoal,UDim2.new(0.088,0,0.133,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Cubic,1,false)
Desc.Text = "Cannon's, Archer tower's, etc"
wait(.1)
Debounce = false
end
end)
Button1.MouseLeave:Connect(function()
if not Debounce then
Debounce = true
Button1:TweenSizeAndPosition(SizeReturn,UDim2.new(0.089,0,0.15,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Cubic,1,false)
Desc.Text = ""
wait(.1)
Debounce = false
end
end)
I’m not sure what’s going on here, but I’ve tried using other guis like a text buttons image labels. The variables are correctly assigned to each button, and I’m pretty sure the variables are set correctly in the :TweenSizeAndPosition. I’ve tried tweening each property separately too (:TweenPosition :TweenSize) but its still glitching. And I’m debouncing the script too. The buttons are inside a frame though, but I don’t think that could be the issue. What going on here?
You’re wrong, tween service is for anything involving what the api specifies
Note that only specific types of properties can be used with TweenService , but multiple properties can be animated in the same tween. The types of properties that can be tweened are:
number
bool
CFrame
Rect
Color3
UDim
UDim2
Vector2
Vector2int16
Vector3
I assume you didn’t even look at the link I provided (my forum post, not tweenservice api) which had an effective example for gui related tweens
I’m trying to tween a gui, and I cannot call a tween service to move a gui or change it’s numbers, because it doesn’t move in the end. Which is why I have to use :TweenPosition or :TweenSize or :TweenSizeAndPosition to get it to move.
But, i’m gonna try it anyway, so I’ll change a UDim2.new() with tween service but I’m not exactly sure it’ll work.
After testing the script for a bit, I found out why it’s broken (atleast, this worked for me): Try setting the Enum.EasingStyle to Quint instead of Cubic in your original script.
--local tweenservice for later creation
local TweenService=game:GetService("TweenService")
local SizeandPositionGoal = {Position=UDim2.new(0.088,0,0.133,0), Size = Udim2.new(0,170,0,140)}
local SizeandPositionReturnGoal = {Position=UDim2.new(0.089,0,0.15,0), Size = Udim2.new(0,150,0,120)}
local tweenInfo = TweenInfo.new(
1, -- Time
Enum.EasingStyle.Cubic, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses
0 -- DelayTime
)
local GoTween = TweenService:Create(Button1, tweenInfo, SizeandPositionGoal )
local ReturnTween = TweenService:Create(Button1, tweenInfo, SizeandPositionReturnGoal )
Yes, weird that I can now tween gui’s with Tween service, couldn’t do that 9 months ago
Anyway this is a valid solution, but @indefiniteOptimist gave a simpler solution, which is don’t use Cubic, LOL. Anyway thx for the help.
Yeah, I have no idea why that doesn’t work. I tested with Exponential too and that didn’t work either, so if it happens again just try to switch the EasingStyle.
Yeah every tween style should work for gui’s too… What about reporting this bug to roblox, I can’t do it since I’m just a we little member on the site.
I’m also a pretty tiny member on the site so I can’t sadly, but hopefully they pick up on it and fix it (assuming there is a problem with studio and not the code).
it is a bug, but they suggest using tweenservice to use cubic easing style until it gets fixed for the functions like tweensize position etc., which may be a long time.