mouse.Button1Down:Connect(function() local HarvestTime = target.WheatConfig.HarvestTime.Value local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=2194604752" local animTrack = Character.Humanoid:LoadAnimation(animation) Character.Humanoid.WalkSpeed = 0 animTrack:Play() Player.PlayerGui.HarvestUI.UI.Bar:TweenSize(UDim2.new (0, 290, 0 ,41), "Out", "Quad", HarvestTime, true) end
I would like to check when my GUI is finished tweening, and when it is a certain size, say 0, 290, 0, 41. It would run the code I have written down, while if it doesn't finish tweening and never reaches 0, 290, 0, 41 in size It won't run anything. I am quite unsure as to how to do this.
TweenSize
is an optional callback which will run code after a GuiObject
has finished tweening.local HarvestTime = target.WheatConfig.HarvestTime local function stuff() -- whatever the function is -- do your code here. end mouse.Button1Down:Connect(function() local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=2194604752" local animTrack = Character.Humanoid:LoadAnimation(animation) Character.Humanoid.WalkSpeed = 0 animTrack:Play() Player.PlayerGui.HarvestUI.UI.Bar:TweenSize( UDim2.new(0, 290, 0 ,41), Enum.EasingStyle.Out, Enum.EasingDirection.Quad HarvestTime.Value, true, stuff -- the function ) end)