I am trying to make animated gui of store to pop up when player clicks store button
the problem that I came across is the debounce of tweening
beacuse I tween in module script with TweenSize I don’t really know how to force local script to wait untill the tween has ended to make v = true/false
Local Script
local screenGui = script.Parent.Parent.Parent.Parent
local button = script.Parent
local frame = script.Parent.Parent.Parent:WaitForChild("Store")
local module = require(screenGui:WaitForChild("Scripts"):WaitForChild("GuiTweener"))
local StartSize = UDim2.new(.1,0,.2,0)
local EndSize = UDim2.new(.3,0,.8,0)
frame.Size = StartSize
local v = false
button.MouseButton1Up:Connect(function()
if v == false then
module.Tween(frame,EndSize,v)
v = true
else
module.Tween(frame,StartSize,v)
v = false
end
end)
Module Script:
local TweenModule = {}
TweenModule.Tween = function(obj,EndSize,v)
if v == false then
obj.Visible = true
obj:TweenSize(EndSize,Enum.EasingDirection.Out,Enum.EasingStyle.Back,.2,false)
else
obj:TweenSize(EndSize,Enum.EasingDirection.In,Enum.EasingStyle.Back,.2,false,function() obj.Visible = false end)
end
end
return TweenModule