#dont know why it wont make another person in my leaderboard

117 messages · Page 1 of 1 (latest)

hexed vapor
#

wdym another person

fickle fern
#

like its my player list

#

when my friend joins only my name shows

hexed vapor
#

local script?

fickle fern
#

do i js remove every local

#

yeah its a local script

hexed vapor
#

no i mean is it a local script

#

oh

hexed vapor
#

change to server and see if it works

fickle fern
#

do i gota delete everything that says local too?

hexed vapor
#

no

dense charm
#

this doesn't quite work the way you want it to logically

#

currently it copies the name UI element and just keeps it in the same position with a different Name and not text

hexed vapor
#

so it wasnt because of the script type?

#

hmm well actually

#

i think you're

#

right

dense charm
#

unless it's a surfaceUI, no

hexed vapor
#

it gets all the players and puts them onto a list the script type doesnt matter

#

oh okay

#

whoops

#

im still learning coding

fickle fern
#
local players = game.Players:GetChildren()
local named = script.Parent.PlayerList.Frame

while true do
    for i,v in pairs(players) do
        local name = named:Clone()
        
        name.Parent = script.Parent.PlayerList.Frame.ScrollingFrame
        name.names.Text = v.Name
    end
    wait(1)
    
    for i,v in pairs(script.Parent.PlayerList.base.ScrollingFrame:GetChildren()) do
        if v:Isa("Frame") then
            v:Destroy()
        end
    end
end




pairs(players)```
#

my names not showing up now

dense charm
#

while true do

#

this is an infinite loop

fickle fern
#

ya

#

so if someone joins

dense charm
#

why would you need it

#

PlayerAdded

fickle fern
#

it adds if someone joins correct? or leaves it removes

#

am i slow

dense charm
#

PlayerAdded and PlayerRemoving events are meant for that

#

a while true loop will just make it messy

#

and constantly be active

hexed vapor
#

yea sorry,

dense charm
hexed vapor
#

the way ur script is constructed is making a bunch of clones of textlabels ofplayer names if i understand correctly

fickle fern
#

bruh what do i do than im s confused

dense charm
#

I get the idea but Im confused about the names text thing

fickle fern
dense charm
#

no no like how it looks

#

in-game

#

or at least

#

is intended to look

fickle fern
vital flare
#

this script runs only once tho if the code sent here is the whole script

fickle fern
#

its not even puting my name up there

vital flare
#

ok so you jsut want a list of the players names right?

fickle fern
#

ya

dense charm
#

wait

#

are you putting all the names into 1 textLabel

#

or creating new ones in a vertical manner?

fickle fern
#

id like to create new ones vertical

#

but idk how

dense charm
#

ah

#

well 2 ways

#

uiListLayout or the messy way of individually creating them

fickle fern
#

ok but first before i do that how come my names not even showing up?

dense charm
#

first add a print check

#

after the for i,v in pairs(players) do add print(i,v)

#

and see if it prints anything

#

oh nvm

#

the table is just empty

#

replace the first line with

local players = game:GetService("Players")```
fickle fern
#

i did

#

i havent shown the script again mbv

#
local players = game:GetService("Players")
local named = script.Parent.PlayerList.Frame

while true do
    for i,v in pairs(players) do
        local name = named:Clone()
        
        name.Parent = script.Parent.PlayerList.Frame.ScrollingFrame
        name.names.Text = v.name
    end
    wait(5)
    
    for i,v in pairs(script.Parent.PlayerList.base.ScrollingFrame:GetChildren()) do
        if v:Isa("Frame") then
            v:Destroy()
        end
    end
end




pairs(players)```
dense charm
#

ehh

#

second

#
local Players = game:GetService("Players")
local named = script.Parent.PlayerList.Frame

while true do
    for _,playerName in game.Players:GetChildren() do
        local name = named:Clone()
        
        name.Parent = script.Parent.PlayerList.Frame.ScrollingFrame
        name.names.Text = playerName.name
    end
    wait(5)
    
    for i,v in script.Parent.PlayerList.base.ScrollingFrame:GetChildren() do
        if v:Isa("Frame") then
            v:Destroy()
        end
    end
end
fickle fern
#

uh

dense charm
#

is it meant to be like that 👀

fickle fern
#

nope!

dense charm
#

no clue what you got going over there man with the ui

fickle fern
#

see were the lable is theres were the names sup to be

dense charm
#

did you reference the label correctlyt in the script?

fickle fern
#

idk

#

hold up

#

i did it

dense charm
#

nice

#

that's step 1

fickle fern
#

how do i make sure it has more than 1 name

dense charm
#

now you gotta remake the whole script cause that while true do is ugly

#

gotta make new Frame's

#

one for each person

fickle fern
#

i did i used my old script i showed i js changed a few things around in explorer

#
local players = game:GetService("Players")
local named = script.Parent.PlayerList.Frame.ScrollingFrame.names
local function PlayerName(players)
    for i,v in pairs(game.Players:GetPlayers()) do
        named.Text = v.Name
        for i=1,25 do
            local clonedObject = named:Clone()
            clonedObject.Name = "clone"..i
             if named.Text == v.Name then
                named:Clone().Text = v.Name
          end
       end
    end
end





PlayerName(players)```
#

now how do i clone it so everytime someone joins it clones and there names there

vital flare
#

you could detect when players join and leave so it adds and removes them from the list with game.Players.PlayerAdded and game.Players.PlayerRemoving

vital flare
dense charm
#
local Players = game:GetService("Players")
local ExampleFrame = script.Parent.PlayerList.Frame.ScrollingFrame.names

local function createNewFrame(PlayerName)
    local newFrame = ExampleFrame:Clone()
    newFrame.Text = PlayerName
    newFrame.Name = PlayerName.."Frame"
    newFrame.Position = ...
end

local function deleteFrame(PlayerName)
    ExampleFrame.Parent[PlayerName.."Frame"]:Destroy()
end

for _,playerName in game.Players:GetPlayers() do -- ran once whenever YOUR player joins the game
  createNewFrame(playerName)
end

Players.PlayerAdded:Connect(function(Player) -- ran once a new player joins
    createNewFrame(Player)
end)

Players.PlayerRemoving:Connect(function(Player) -- ran once a player leaves
    deleteFrame(Player)
end)

something like this

dense charm
#

too

#

depends on what he's using

vital flare
#

fair

fickle fern
#

woild this work

dense charm
#

yes and no

#

it works, but not in the way that you want it to

#

you need a list of players

#

this just replaces the current labels text with the new player

#

and keeps the one singular label

fickle fern
#

what if i make more than 1 lable

dense charm
#

sure

#

try it

fickle fern
dense charm
#

, but honestly I'd suggest looking into uiListLayout

#

😢

dense charm
#

there's honestly no easy path for this

#

if you try to take it then it'll just come out horrible

fickle fern