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

Listing players into a frame?

Asked by
xudet 0
4 years ago

How would I go about adding the names of players into a frame, apart from your own player's name? Sort of like everyone else's name is in the frame apart from your own, I'm creating a WHODUNNIT game and you have to vote off the suspected killer, but I don't know how you would add players to the frame but make it that your own name doesn't show up

0
me no comprendo TheRealPotatoChips 793 — 4y
0
You would put a Ui grid layout, in that frame. Then a script, that when a player joins, it copys a textlabel, or whatever you want their name to be on and puts it into the frame. Then take their name, and put it into the label. zandefear4 90 — 4y
0
For your own name not showing up, you would use a local script to do that. zandefear4 90 — 4y

1 answer

Log in to vote
0
Answered by
Nootian 184
4 years ago
Edited 4 years ago

You would use I-Pairs with a local script, and everytime someone joins or leaves you update it:

Player = game.Players.LocalPlayer
function UpdatePlayers(PlayerName)
    for i, v in pairs(game.Players:GetChildren()) do
        if v.Name ~= Player.Name then
            --Here you would add a frame corresponding to the name and number
            --The playerNumber is: i
            --The playerName is: v.Name
        else
            --Here is Your name in the game
            --The position of Your name

        end
    end
end
UpdatePlayers(Player)
game.Players.PlayerAdded:Connect(UpdatePlayers)
game.Players.PlayerRemoving:Connect(UpdatePlayers)
Ad

Answer this question