--// Variables \\--
local PlayerListFrame = script.Parent.PlayerList
--// Function \\--
function playerAdded(Player)
print("test")
wait()
for _,v in pairs(PlayerListFrame:GetChildren()) do
if v:IsA("Frame") then
if v.PlayerName.Text == Player.Name then return end
end
end
local clone = script.PlayerTab:Clone()
clone.Parent = PlayerListFrame
clone.Class.Text = Player:WaitForChild("Stats").Class.Value
clone.Coins.Text = tostring(Player.Stats.Coins.Value)
clone.Kills.Text = tostring(Player.Stats.Kills.Value)
clone.Level.Text = tostring(Player.Stats.Level.Value)
clone.PlayerName.text = Player.Name
local siz = PlayerListFrame.UIListLayout.AbsoluteContentSize
PlayerListFrame.CanvasSize = UDim2.new(0, siz.X, 0, siz.Y)
end
function playerRemoving(Player)
for _,v in pairs(PlayerListFrame:GetChildren()) do
if v:IsA("Frame") then
if v.PlayerName.Text == Player.Name then
v:Destroy()
end
end
end
local siz = PlayerListFrame.UIListLayout.AbsoluteContentSize
PlayerListFrame.CanvasSize = UDim2.new(0, siz.X, 0, siz.Y)
end
game:GetService("Players").PlayerAdded:Connect(playerAdded)
game:GetService("Players").PlayerRemoving:Connect(playerRemoving)
Basically there is a ScreenGui, and has the localscript, a scrollingframe (PlayerListFrame) and a topbar as the children. The child of the localscript is a sample frame, with basically TextLabels for playername, stats etc etc. However, when I try to run this in both studio and game it does not work. I do not get a print for the playerAdded function and there are no errors in output. Why is this script not working?
