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)

7 comments

0

Add an if statement to make sure Hit.Parent ~= nil so that way I think this error will stop.

0

Okay thanks

0

It still doesn't work. ..

0

if Hit.Parent:IsA("Humanoid") then

0

Alt, that would be wrong because the Hit.Parent's parent is the model, not a humanoid.

0

block code please

0

I FIXED IT! It was the id ... i forgot to change it to in interger