Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont this custom player list show up?

This LocalScript is inside a ScreenGui, There is a Frame with a TextLabel in ReplicatedStorage, and a Frame inside the ScreenGui

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

local itemplayer = game:GetService("ReplicatedStorage"):WaitForChild("itemplayer")
local holder = script.Parent:WaitForChild("holder")
local player

local function add(Player)
	local new = itemplayer:Clone()
	new.Name = Player.Name
	new.name.Text = Player.Name
	if not new.name.TextFits then
		new.name.TextScaled = true
	end
	new.Postiton = UDim2.new(0.87, 0, .01 + (.05 * #holder:GetChildren()), 0)
	new.Parent = holder
end

for i,v in pairs(game:GetService("Players"):GetPlayers()) do
	add(v)
end

game.Players.PlayerAdded:Connect(function(player)
	add(player)
end)

game.Players.PlayerRemoving:Connect(function(player)
	local find = holder:FindFirstChild(player.Name)
	if find then
		find:Destroy()
	end
end)

This is the error I get: Position is not a valid member of Frame on line 14

3 comments

0

You declared player as a nil value?

0

The variable you passed has a capital P.new name = Player.Name

0

ok fixed it-ish

1 answer

player is a nil value. I believe you’re looking for Player.


game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

local itemplayer = game:GetService("ReplicatedStorage"):WaitForChild("itemplayer")
local holder = script.Parent:WaitForChild("holder")
local player

local function add(Player)
    local new = itemplayer:Clone()
    new.Name =Player.Name
    new.name.Text = player.Name
    if not new.name.TextFits then
        new.name.TextScaled = true
    end
    new.Postiton = UDim2.new(0.87, 0, .01 + (.05 * #holder:GetChildren()), 0)
    new.Parent = holder
end

for i,v in pairs(game:GetService("Players"):GetPlayers()) do
    add(v)
end

game.Players.PlayerAdded:Connect(function(player)
    add(player)
end)

game.Players.PlayerRemoving:Connect(function(player)
    local find = holder:FindFirstChild(player.Name)
    if find then
        find:Destroy()
    end
end)

3 comments

0

ok now its the same error but says it on line 10

0

oh wait i can fix that

0

ok new error, position not valid member of frame (line 14)

This discussion is preserved as it was. New answers, comments, and votes are closed.