Tween goes down but not up

I have some code and the GUI goes up but now down.

-- Team Change

local GUI = PG.ScreenGui.TeamChange
local open = PG.ScreenGui.Frame.Teams

local civs = GUI.Civilians
local cops = GUI.Police
local crims = GUI.Criminals

-- Teams

local teams = game:GetService("Teams")

local civTeam = teams.Civilians
local copTeam = teams.Police
local crimTeam = teams.Criminals

-- Main
open.MouseEnter:Connect(function()
	hover:Play()
end)

open.MouseButton1Click:Connect(function()
	local down = false
	if down == false then
		down = true
		click:Play()

		local info = TweenInfo.new(1)
		local properties = {Position = UDim2.new(0, 100,0, 0)}

		local tween = TS:Create(GUI, info, properties)
		tween:Play()
		
	else
		down = false
		click:Play()
		
		local info = TweenInfo.new(1)
		local properties2 = {Position = UDim2.new(0, 100,-1, 0)}
		
		local tween = TS:Create(GUI, info, properties2)
		tween:Play()
	end
end)

At the bottom by the way. (curse character limit)

Place local down = false outside open.MouseButton1Click:Connect(function() ... end

down is a local variable of said function, not of the entire script.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.