I found this script and liked it but I wanted to know why it works with line 3 being not a function. I also though want to fix it because it says in my console that line 3 can not be connected because its not a function? Any help I tried making it a function and it broke the whole script.
groupid = 2758901
game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
wait(1)
if newPlayer:IsInGroup(groupid) then
local gui=Instance.new("BillboardGui")
gui.Parent=newPlayer.Character.Head
gui.Adornee=newPlayer.Character.Head
gui.Size=UDim2.new(4,0,2,0)
gui.StudsOffset=Vector3.new(0,3,0)
local texta=Instance.new("TextBox")
texta.Size=UDim2.new(1,0,2,0)
texta.BackgroundTransparency = 1
texta.Text = ("- " .. newPlayer:GetRoleInGroup(groupid) .. " -")
texta.Parent=gui
end
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)

2 comments
Why are there -8 points?
I have no clue.