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

20:20:43.163 - Workspace.Part.Script:11: bad argument #2 to '?' (string expected, got nil)

Asked by 5 years ago

So i was wondering how to make a queue script

and im wondering if this is how u do it.

if 10 values are in the table, it searches for the player and teleports

them to the game

--// Variables

local QueueTable = {}

local Max = 10

local id = "dont worry about this. i dont have one yet"

--// Code

script.Parent.Touched:Connect(function(Hit)

if Hit.Parent:FindFirstChild('Humanoid') then

local N = Hit.Parent.Name

table.insert(QueueTable,N)

if QueueTable[10] then

local Players = game.Players[QueueTable[N]]

game:GetService('TeleportService'):Teleport(id,QueueTable[N])

end

else print(360..' Ooga booga')

return false

end

end

end)

0
Add an if statement to make sure Hit.Parent ~= nil so that way I think this error will stop. GottaHaveAFunTime 218 — 5y
0
Okay thanks DEVLogos 8 — 5y
0
It still doesn't work. .. DEVLogos 8 — 5y
0
if Hit.Parent:IsA("Humanoid") then AltNature 169 — 5y
View all comments (3 more)
0
Alt, that would be wrong because the Hit.Parent's parent is the model, not a humanoid. DEVLogos 8 — 5y
0
block code please HomieFirePGN 137 — 5y
0
I FIXED IT! It was the id ... i forgot to change it to in interger DEVLogos 8 — 5y

Answer this question