Need help making my team gui work

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make my Team button work and make it show the gui
  2. What is the issue? Include screenshots / videos if possible!
    When I click on the Teams button, it doesn’t showup the teams gui.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried rewriting it and all that, but nothing works.

Script:

local Player = game:GetService('Players').LocalPlayer
local Shared = game:GetService('ReplicatedStorage'):WaitForChild('Shared')

do -- Animations
	
	local Frame = script.Parent:WaitForChild('Animations')
	local AnimationsPlaying = {}
	local HoldingALoop = {}
	
	local function HandleAnimationsClick(table, name)
		local start  = table.start
		local loop   = table.loop
		local finish = table.finish
		
		local humanoid = Player.Character:FindFirstChild('Humanoid')
		if not humanoid then return end
		
		if not AnimationsPlaying[name] then
			AnimationsPlaying[name] = 1
		end
		
		if AnimationsPlaying[name] == 1 then
			-- Play animation then play the loop
			if start then
				-- play
				local instance = Instance.new('Animation', humanoid) instance.AnimationId = start
				local anim = humanoid:LoadAnimation(instance)
				anim:Play()
				wait(anim.Length)
			end
			
			if loop then
				-- play
				if name =='Pushups' then
					Player.Character.Humanoid.WalkSpeed = 0
				end
				local instance = Instance.new('Animation') instance.AnimationId = loop
				local anim = humanoid:LoadAnimation(instance)
				anim:Play()
				HoldingALoop[name] = anim
			end
			
			print('Play animation then play the loop')
			AnimationsPlaying[name] = 2
		elseif AnimationsPlaying[name] == 2 then
			-- End the animation
			if HoldingALoop[name] then
				HoldingALoop[name]:Stop()
				HoldingALoop[name] = nil
			end
			
			if finish then
				-- play			
				local instance = Instance.new('Animation') instance.AnimationId = finish
				local anim = humanoid:LoadAnimation(instance)
				anim:Play()
				wait(anim.Length)
				anim:Stop()
			end
			
			if name =='Pushups' then
				Player.Character.Humanoid.WalkSpeed = 16
			end
			
			print('End the animation')
			AnimationsPlaying[name] = 1
		end
	end

	local Animations = {
		['Salute'] = {
			start = 'rbxassetid://3534418531', 
			loop = 'rbxassetid://3534420241', 
			finish = 'rbxassetid://3534416462',
		},
		['AtEase'] = {
			start = 'rbxassetid://3534409407', 
			loop = 'rbxassetid://3534412059', 
			finish = 'rbxassetid:///3534414271',
		},
		['Pushups'] = {
			loop = 'rbxassetid://3534406554', 
		},
	}
	spawn(function()
		for _, v in next, Frame:WaitForChild('Main'):WaitForChild('Animations'):GetChildren() do
			if v:IsA('TextButton') then
				v.MouseButton1Click:Connect(function()
					HandleAnimationsClick(Animations[v.Name], v.Name)
				end)
			end
		end
	end)
	script.Parent:WaitForChild('AnimationsButton').MouseButton1Click:Connect(function()
		Frame.Main.Visible = not Frame.Main.Visible
	end)
end

do -- Gamepasses
	
	local Gamepasses = require(Shared:WaitForChild('Modules').Gamepasses)
	local Frame = script.Parent:WaitForChild('Gamepasses')
	local MarketplaceService = game:GetService('MarketplaceService')
	
	local List
	local List1 = Frame:WaitForChild('Main'):WaitForChild('Gamepasses1')
	local List2 = Frame:WaitForChild('Main'):WaitForChild('Gamepasses2')
	local Blur = Instance.new('BlurEffect', game:GetService('Lighting'))
	Blur.Size = 3
	Blur.Enabled = false
	
	local ListMax = 9 -- +1 for the UIGridLayout
	
	local Size = 0
	local Template = Frame:WaitForChild('Template')
	
	local function new_pass(name, id, type)
		id = id[1]
		if #List1:GetChildren() >= ListMax then
			List = List2
		else
			List = List1
		end
		local info = MarketplaceService:GetProductInfo(id, type)
		if info.IsForSale then
		    local new = Template:Clone()
			if type == Enum.InfoType.GamePass then
				name = info.Name
			else
				name = name
			end
		    new.ItemName.Text = name
			new.Price.Text = "R$"..info.PriceInRobux
			new.ImageLabel.Image = 'rbxassetid://'..info.AssetId
		    new.Parent = List
		    new.Visible = true
		    return new, id
		else
			print('not on sale')
		end
	end
	
	spawn(function()
		for name, id in next, Gamepasses do
		    local new = new_pass(name, id, Enum.InfoType.GamePass)
			if new then
			    new.Buy.MouseButton1Click:Connect(function()
			      MarketplaceService:PromptGamePassPurchase(Player, id[1])
			    end)
			end
		end
	end)
	
	local function product(new, id)
		new.Buy.MouseButton1Click:Connect(function()
			MarketplaceService:PromptProductPurchase(Player, id)
		end)
	end
	
	product(new_pass('$500', {637123760}, Enum.InfoType.Product))
	product(new_pass('$2,000', {637124024}, Enum.InfoType.Product))
	product(new_pass('$5,000', {637125167}, Enum.InfoType.Product))
	
	script.Parent:WaitForChild('GamepassButton').MouseButton1Click:Connect(function()
		Frame.Main.Visible = not Frame.Main.Visible
		Blur.Enabled = not Blur.Enabled
	end)
end

do -- Teams
	local TeamsFrame = script.Parent:WaitForChild('Teams')
	local Remote = Shared:WaitForChild('Remotes'):WaitForChild('Team')
	local TeamModule = require(Shared:WaitForChild('Modules'):WaitForChild('Teams'))
	local Template = TeamsFrame:WaitForChild('Template')
	local List = TeamsFrame:WaitForChild('Main'):WaitForChild('Teams')
	
	local Size = 0
	local Blur = Instance.new('BlurEffect', game:GetService('Lighting'))
	Blur.Size = 3
	Blur.Enabled = false
	
	local function new_team(name, color)
		Size = Size + 0.082
		TeamsFrame:WaitForChild('Main').Size = UDim2.new(0.15, 0, Size, 0)
	
		local newcolor = color.Color
	    local new = Template:Clone()
	    new.BackgroundColor3 = newcolor
	    new.Text = name
	    new.Parent = List
	    new.Visible = true
	    return new
	end
	
	local new = new_team('Visitors', BrickColor.new('Mid gray')) -- ??
	new.MouseButton1Click:Connect(function()
	    Remote:FireServer({'SwitchTeam', 'Visitors'})
	end)
	
	for name, table in next, TeamModule do
	    local new = new_team(name, table.color)
	    new.MouseButton1Click:Connect(function()
	        Remote:FireServer({'SwitchTeam', name})
	    end)
	end
	
	script.Parent:WaitForChild('TeamButton').MouseButton1Click:Connect(function()
		TeamsFrame.Main.Visible = TeamsFrame.Main.Visible
		Blur.Enabled = Blur.Enabled
	end)
end

script.Parent:WaitForChild('TeamButton').MouseButton1Click:Connect(function()
	TeamsFrame.Main.Visible = TeamsFrame.Main.Visible
	Blur.Enabled = Blur.Enabled
end)

it’s not becoming Visible because if it was Visible false, then you’re simply setting it to Visible false again.

Try changing it to

   script.Parent:WaitForChild('TeamButton').MouseButton1Click:Connect(function()
    	TeamsFrame.Main.Visible = not TeamsFrame.Main.Visible
    	Blur.Enabled = not Blur.Enabled
    end)

That way if it’s Visible false, it will be Visible true

Seems like you just forgot to add not

It still doesn’t open up the Team GUI?

Is this in a script or a localscript?

where is the script located in the hierarchy


https://gyazo.com/63cd0ca38db920367595d332fa5f1d31

LocalScript (30 characters —)

    	script.Parent:WaitForChild("TeamButton").MouseButton1Click:Connect(function()
    	if TeamsFrame.Main.Visible == false then -- Checks if player is on team gui or not
        TeamsFrame.Main.Visible = true
    	Blur.Enabled = true
    	else
    	TeamsFrame.Main.Visible = false
    	Blur.Enabled = false
    	end)

This hopefully solves your issue here.

This functions the same as my reply.
Setting a variable to not variable just inverses it.

1 Like


https://gyazo.com/67416c72e76302717aa78a3fc4ab0d12

What is the error above it? That only shows what line it’s from

“local Gamepasses = require(Shared:WaitForChild(‘Modules’).Gamepasses)”

It’s because I didn’t create a folder in the Modules yet.


https://gyazo.com/4cc9535cd50a8e41f0e7dc4052702fbe

Same Line:

local Gamepasses = require(Shared:WaitForChild('Modules').Gamepasses)

I don’t see any “Gamepasses” module in ReplicatedStorage.Shared.Modules
image
Did you add it or change the order? Please screenshot the explorer again


https://gyazo.com/9f9931b53465efe7af4d76fe1b1860da

A valid argument would be a module script, but you used a value object instead.