#attempt to get length of instance value when trying to get a random player
1 messages · Page 1 of 1 (latest)
may I see the error
you're indexing a service
:GetPlayers()
holup
** You are now Level 10! **
here the error
also heres the whole thing
i was trying to change the team of that specific player
what should i do instead
use the service and call :GetPlayers()
try to separate them
then do the getplayers
``lua
oh bruh
lua
wait I forgot how to do it holdon
local Players = game:GetService("Players")
for _, player in Players:GetPlayers() do
print(player.Name)
end
wouldnt that just get all players
yea but change the value
local table = Players:GetPlayers()
local killer = math.random(1, #table)
ok ima try that
buh
crazy fix
wtf is the team for
use table fields or attributes or sum sh
!!
that just returns a number
it doesen;t get an actual player
Try this instead
local table = Players:GetPlayers()
local abc = math.random(1, #table)
local killer = table[abc]