So i want a gui to pop with a list of all player names for an invite system.
my script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local list = ReplicatedStorage:WaitForChild("PlayerList")
local ScrollingFrame = script.Parent.ScrollingFrame
local Players = game:GetService("Players")
local player1 = game.Players.LocalPlayer
local char = player1.Character or player1.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
repeat wait() until cam.CameraSubject ~= nil
char.Archivable = true
local dummy = char:Clone()
dummy.Parent = workspace
dummy:MoveTo(workspace.LobbySpawns.MainSpawn.Position)
local function PlayerList(player)
local CloneFrame = list:Clone()
CloneFrame.TextLabel.Name = player.Name
CloneFrame.TextLabel.Text = player.Name
list.Parent = ScrollingFrame
CloneFrame.Visible = true
if CloneFrame.TextLabel.Text == player1.Name then
CloneFrame:Destroy()
end
end
local function PlayerJoined(player)
PlayerList(player)
end
for _, players in pairs(Players:GetPlayers()) do
PlayerList(players)
end
local function PlayerLeft(plr)
for i, v in pairs(ScrollingFrame:GetChildren()) do
if v.Name == plr.Name then
v:Destroy()
end
end
end
wait(3)
Players.PlayerAdded:Connect(PlayerJoined)
Players.PlayerRemoving:Connect(PlayerLeft)
it worked when it was cloning a textlabel but when i switched from textlabel to a frame it didnt work anymore.
when i press play i have an error: TextLabel is not a valid member of Frame "PlayerList"