Hi all, for some reason my tweened open and close GUI fails to work. There are no errors in the output.
local frame = script.Parent.Parent.Clothingframe
local button = script.Parent
button.MouseButton1Click:Connect(function()
if frame.Visible == false then
frame.Visible = true
frame:TweenPosition(UDim2.new(1,0.5,0.365, -15)) -- Put the position to tween to.
else
frame:TweenPosition(UDim2.new(1.575,-20,0.365, -15)) -- Put the position to tween back to
wait(3)
frame.Visible = false
end
end)
local frame = script.Parent.Parent.Clothingframe
local button = script.Parent
local deb= false
button.MouseButton1Click:Connect(function()
if not deb then
deb=true
frame.Visible = true
frame:TweenPosition(UDim2.new(1,0.5,0.365, -15)) -- Put the position to tween to.
elseif deb then
deb= false
frame:TweenPosition(UDim2.new(1.575,-20,0.365, -15)) -- Put the position to tween back to
frame.Visible = false
end
end)
local tweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tween = TweenService:Create(part, tweenInfo, {Position = Vector3.new(0, 30, 0)})
tween:Play()
Updated script: (Still doesn’t work, not sure if I did it right)
local frame = script.Parent.Parent.Clothingframe
local button = script.Parent
local deb = false
button.MouseButton1Click:Connect(function()
if not deb then
deb = true
frame.Visible = true
frame:TweenPosition(UDim2.new(1,0.5,0.365, -15), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 1)
elseif deb then
deb = false
frame:TweenPosition(UDim2.new(-1,-0.5,-0.365, -15), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 1)
frame.Visible = false
end
end)
try out this while putting the frame as visible true
local frame = script.Parent.Parent.Clothingframe
local button = script.Parent
local deb = false
button.MouseButton1Click:Connect(function()
if not deb then
deb = true
frame:TweenPosition(UDim2.new(1,0.5,0.365, -15), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 1)
elseif deb then
deb = false
frame:TweenPosition(UDim2.new(-1,-0.5,-0.365, -15), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 1)
end
end)
local frame = script.Parent.Parent.Clothingframe
local button = script.Parent
local deb = false
button.MouseButton1Click:Connect(function()
if not deb then
deb = true
frame:TweenPosition(UDim2.new(1,0.5,0.365, -15), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 1)
elseif deb then
deb = false
frame:TweenPosition(UDim2.new(0.44, 0,0.365, -15))
end
end)