Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago
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

Log in to vote
0
Answered by 6 years ago

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
0
Where do I put it Jade7070 0 — 6y
Ad

Answer this question