local template = script.Template
local Players = game:GetService("Players")
local playere = game.Players.LocalPlayer
local playerList = script
function clearlist()
for _m, item in pairs(playerList:GetChildren()) do
if item:IsA("TextLabel") then
item.Destroy()
end
end
end
for _, team in ipairs(Teams:GetTeams()) do
local frame = template:Clone()
frame.Name = team.Name
frame.LayoutOrder = #playerList:GetChildren()
end
function FillList()
for _, player in pairs(Players:GetChildren()) do
if not playerList:FindFirstChild(player.Name) then
local frame = template:Clone()
frame.Name = player.Name
frame.player.Text = player.Name
frame.Parent = playerList
frame.LayoutOrder = playerList[player.Team.Name].LayoutOrder + 1
for _, object in pairs(playerList:GetChildren()) do
if object:IsA("Frame") and object.LayoutOrder >= frame.LayoutOrder and object ~= frame then
object.LayoutOrder = object.LayoutOrder +1
end
end
player:GetPropertyChangedSignal("TeamColor"):Connnect(function()
frame.LayoutOrder = playerList[player.Team.Name].LayoutOrder + 1
end)
end
end
end
FillList()
game.Players.PlayerAdded:Connect(FillList)
game.Players.PlayerRemoving:Connect(FillList)
Error - Connect is not a valid member of RBXScriptSignal
Okay this script is quite messy, could you attempt to re-code it?
Your code has game.Players.LocalPlayer, which can only be used in a localscript, your script is meant to be in the server script.
Connect is not a valid member of RBXScriptSignal
This script manages to work:
local function fillList()
print("Hi!")
end
game.Players.PlayerAdded:Connect(fillList)
Consider editing this and the other function to be local function FillList()
Something like this would work:
function clearlist()
print("ClearList")
end
function FillList()
print("FillList")
end
FillList()
game.Players.PlayerAdded:Connect(FillList)
game.Players.PlayerRemoving:Connect(FillList)
If you need any help with coding a new script, this might help: