I have the script to where it puts a boolian in the player but I need to check if the players value is true or not then teleport the player if false. Idk the proper way of doing this. leik?
The only thing that's erroring is :GetChildren()
error: Value is not a valid member of Camera
Spawns = game.Workspace.Spawns Players = game.Players:GetChildren() AFKCheck = game.Workspace:GetChildren() for PlayerTeleport = 1, #Players do if game.Workspace:FindFirstChild(Players[PlayerTeleport].Name) then if AFKCheck[PlayerTeleport].Value == false then Players[PlayerTeleport].Character.Torso.CFrame = Spawns[_G.StartingPlaces[math.random(1,#_G.StartingPlaces)]].CFrame * CFrame.new(0,8,0) else end end end
game.Players.PlayerAdded:connect(function(plr) wait(1) player = game.Workspace:FindFirstChild(plr.Name) end)
Try that out, it will get the players from the Player table and it will find it in Workspace, hope this helps! This isn't the whole question, just the fix by the way.
To get each player in Workspace, do this:
local Players = game.Players:GetPlayers() for i,Player in ipairs (Players) do local Character = Player.Character end
to count players, use:
game.Players.NumPlayers()