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

Keeps saying unable to cast value to object?

Asked by 5 years ago

I have a script where there are four string values in a queue and each has the name of a player in game. Every time i run it, it says Unable to cast value to object. Anyone know any way to fix it?

    for i,v in pairs(queue1) do
            local plr = game.Players:WaitForChild(v.Name)

TS:TeleportToPrivateServer(3350448651,code,plr)

1 answer

Log in to vote
0
Answered by 5 years ago

on the wiki it says the 3rd argument is an array of players so maybe you should do this

    local plrs={}
    for i,v in pairs(queue1) do
            local plr = game.Players:WaitForChild(v.Name)
        players:insert(plr)

end
TS:TeleportToPrivateServer(3350448651,code,plrs)
Ad

Answer this question