Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I hide a frame that depends on the number of people in a team?

Asked by 3 years ago
Edited 3 years ago

Hello, I'm scripting a custom playerlist and I'd like to hide teams which have no players in it. Problem is I don't understand how to code it: I can't find a way to link the frame (which has the exact name of the team) and the actual team.

Here's some code and photos:

(NonInUsoTeam is the folder in ReplicatedStorage where I want the frames to be stored)

    if #team:GetPlayers() == 0 then
        local frames = playerlist:GetChildren()
        if frames.Name == team.Name and #team:GetPlayers() == 0 then
            frames.Parent = game.ReplicatedStorage.NonInUsoTeams
        end
    end

This if is in a for loop, I've tried with a print and it prints the number of the teams with players missing.

Oh and playerlist is the ScrollingFrame.

GUI: https://gyazo.com/3c9f0773931f3cbbc002c34e877682d4

(The local script in it is a Canvas Size thing of the scrolling frame, nothing to do with the actual script)

The name of the frames is equivalent to the names of the teams. If someone could help it would be amazing, thank you in advance.

Answer this question