Seperate Players to different platforms

Im having trouble of thinking of a way to seperate players

If I wanted to teleport 5 players onto these 5 platforms, one on each platform, how would I do it?


have a table of platforms, iterate the table choose a player, set player position to platform, disable that platform from table, continue with the iterations until filling the 5 platforms, but totally depends on exactly what mechanics you desire

First we have to loop through the players and we need an array of the 5 platforms.
Let’s assume you put the 5 platforms inside a folder (with nothing else inside of them) then we would need to do the following.

  1. Make sure the player has a character & a HumanoidRootPart
  2. Via the index of the player we get the index necessary for one of the 5 platforms
  3. We teleport the player to one of these 5 platforms.
local PlayerService = game:GetService("Players")

local PlatformFolder = ...

-- the function:
for i, player in pairs(PlayerService:GetPlayers()) do
   local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
   if root then
      local platform = PlatformFolder:GetChildren()[i]
      if platform then
         root.CFrame = platform.CFrame +, 3, 0)
      else warn("Platform with index " .. tostring(i) .. " was not found!") end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.