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?

1    for i,v in pairs(queue1) do
2            local plr = game.Players:WaitForChild(v.Name)
3 
4TS: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

1    local plrs={}
2    for i,v in pairs(queue1) do
3            local plr = game.Players:WaitForChild(v.Name)
4        players:insert(plr)
5 
6end
7TS:TeleportToPrivateServer(3350448651,code,plrs)
Ad

Answer this question