Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Player List GUI Isn't working properly? (Script inside)

Asked by 4 years ago

I did a test server with 3 players in roblox studio.

player1 joined and then player2 and then player 3

Player1's playerlist had player1 and 2 and 3. Player2's playerlist had 2 and 3. Player3's playerlist had only 3. ??!?!?!?

I have a folder inside Workspace called PlayerListFolder which has a script: ~~~~~~~~~~~~~~~~~

game.Players.PlayerAdded:connect(function(plr)
    wait(.1)
    player = Instance.new("StringValue", game.Workspace.PlayerListFolder.PlayersINT)
    player.Name = plr.Name
    player.Value = plr.Name
end)

game.Players.PlayerRemoving:connect(function(plr2)
    if game.Workspace.PlayerListFolder.PlayersINT:FindFirstChild(plr2.Name) then
        game.Workspace.PlayerListFolder.PlayersINT[plr2.Name]:remove()
    end
end)

and another thing in the Folder is PlayersINT which keeps the StringValues of players.

In startergui I have a screengui and inside that is a frame which I renamed to MainFrame and the script inside screengui is:

Main = script.Parent.MainFrame

Pos = 0

function updatelist()
    allgui = Main:GetChildren()

    for i = 1, #allgui do
        allgui[i].Position = UDim2.new(0, 0, 0, Pos)
        Pos = Pos + 30
    end
    Pos = 0
end


game.Workspace.PlayerListFolder.PlayersINT.ChildAdded:connect(function(plr)
    wait(.2)
    Frame = Instance.new("Frame", Main)
    Frame.BackgroundTransparency = 0.96
    Frame.Name = plr.Name
    Frame.Size = UDim2.new(0, 195, 0, 30)
    Frame.Position = UDim2.new(0, 0, 0, 0)

    TextLabel = Instance.new("TextLabel", Frame)
    TextLabel.Text = plr.Name
    TextLabel.BackgroundTransparency = 0.5
    TextLabel.BackgroundColor3 = Color3.new(0, 0, 0)
    TextLabel.Size = UDim2.new(0, 195, 0, 30)
    TextLabel.Position = UDim2.new(0, 0, 0, 0)
    TextLabel.Font = "SourceSans"
    TextLabel.FontSize = "Size14"
    TextLabel.TextColor3 = Color3.new(241, 241, 241)
    TextLabel.TextScaled = false
    TextLabel.TextWrapped = true
    updatelist()
end)




game.Workspace.PlayerListFolder.PlayersINT.ChildRemoved:connect(function(plr2)
    wait(.1)
    if Main:FindFirstChild(plr2.name) then
        Main[plr2.name]:remove()
        updatelist()
    end
end)
0
you need to clone it into the starter gui wackem 50 — 4y
0
What do you mean? XxSHjokerxX 18 — 4y
0
And clone what? XxSHjokerxX 18 — 4y

Answer this question