I am working with tables and I am creating a table of 4 blocks in a model. I create this table and do a math.random from 1 to the amount of players in game. After I do so I create a for i,v in pairs do loop. I check for the players and have them teleport to the selected brick in a table, but it does not teleport the player. Instead it reads over it and moves to the next line. I tried using CFrame, Vector3, :MoveTo() and none of them worked.
game.Players.PlayerAdded:Connect(function(Person)
Person.CharacterAdded:wait()
local Players = game.Players:GetPlayers() --Gets Players
local Table = {Players}
local Random = math.random(1, #Players) --Finds Amount of Players
print(Players[Random])
local PickedPlayer = Players[Random] --Picks Player
local ModelTest = game.Workspace.TestModel2:GetChildren() --(4 Parts)
if Random == 1 then
for i, v in pairs(ModelTest) do
if v == ModelTest[1] then
PickedPlayer.Character:MoveTo(ModelTest[1].Position)
print("Moved Past")
PickedPlayer.Character.Torso.Transparency = 0.9
end
end
end
end)
It prints "Moved Past" ignoring the previous line and moving onto the next making the Torso's transparency 0.5.
