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

Ive done everything, this script will not work at all, what do I do?

plynumber = tonumber(string.sub(script.Parent.Name,4))
print(plynumber)
function checklol()
ppl = game.Players:GetChildren()
print("checking")
if #ppl >= plynumber then
script.Parent.Visible = true
print("yes")
ply = ppl[plynumber]
script.Parent.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=200&y=200&Format=Png&username="..ply.Name
function hover()
script.Parent.Parent.plyname.Text = ply.Name
end
script.Parent.MouseEnter:connect(hover)
function left()
script.Parent.Parent.plyname.Text = ""
end
script.Parent.MouseLeave:connect(left)
else
script.Parent.Visible = false
end
end
checklol()
game.Players.Changed:connect(checklol)

it says 02:29:31.822 - Players.Jade7070.PlayerGui.Model.PES.Main.Main.MainScript.Script:6: attempt to compare nil with number

1 answer

I'm not sure that's how you use the # character to get the length of a table. Instead of that you might want to create a function since # is complicated and sometimes returns nil. So just use this:

function tablelength(T)
  local count = 0
  for _ in pairs(T) do count = count + 1 end
  return count
end

1 comment

0

Where do I put it

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