I am trying to pick a random CFrame from a table so the players can teleport to a random CFrame...
local Ceev= {CFrame.new(-6601.1, 216.5, 137.8),CFrame.new(-6685.1, 216.5, 187.2)} local Ctarget = math.random(#Ceev) print(Ctarget) for i, player in pairs(game.Players:GetPlayers()) do player.Character.Torso.CFrame = Ctarget + Vector3.new( 0 * math.random(1, 2) , 0 * 2 , i * 2) end
You haven't set Ctarget to one of the values in Ceev, you've set it to a random number up to the number of values in Ceev. You need to do Ceev[math.random(1,#Ceev)]
to do this correctly.
local Ceev= {CFrame.new(-6601.1, 216.5, 137.8),CFrame.new(-6685.1, 216.5, 187.2)} local Ctarget = Ceev[math.random(1,#Ceev)] print(Ctarget) for i, player in pairs(game.Players:GetPlayers()) do player.Character.Torso.CFrame = Ctarget + Vector3.new( 0 * math.random(1, 2) , 0 * 2 , i * 2) end
Hope this works for you!