He wants to put the players in 1 folder
i wanna put the player into 2 folder
I literally don’t understand this thread, no one is speaking clearly in english
local val = math.random(1,2)
if val == 1 then
for i, v in pairs(game.Players:GetChildren()) do
if v then
local characters = v.Character
characters.Parent = game.Workspace.Tug1
end
end
elseif val == 2 then
for i, v in pairs(game.Players:GetChildren()) do
if v then
local characters = v.Character
characters.Parent = game.Workspace.Tug2
end
end
end
That’s not called teleporting that’s called moving the character model, I’m pretty you can’t/aren’t supposed to move the players character model.
If you want to group different players for different things, create tables and put the player instance or character instance in the tables, you can even use ObjectValues if you want.
There is no need to be moving around the character model.
use this it will work as the players in Folder
local Folder = ""---------- the place you want be player in
local Value = Instance.new("ObjectValue",Folder )
Value.Value = Player
Value.Name = Player.Name
easy dont think this?
ill make it clear I want the Player move into 2 folder like
there is 2 player the one player is going to teleport into 1 folder and the other player is going to teleport into 2 folder
I don’t get what you mean teleport into folder.
You are telling me there is a big model in your game that looks like a filing folder and you want the character to teleport into it?
To do that all you need to do is set the Characters cframe to the cframe of the big floating Folder Model you want to teleport to.
xD he want to move player in Folder not teleporting him
wait ill explain more clear im very sorry
these 4 players will teleport into
these 2 folder in split like this
yes thats what i want i want the player move into folder
This thread is hilarious Lmao
Okay I just found out it says you can move player characters
I still think there’s no point in moving them around because then when the character respawns you have to move them again but whatever (unless that’s what you want)
All you have to do to parent something in Luau is do
Instance.Parent = OtherInstance
In this case you want to put the Character models in folders so
player.Character.Parent = Folder
Edit: in the picture you sent you have characters under the “players” service, that’s not where they are all characters are in workspace
but i want the player move into 2 folder in split thats why i use math.random my only problem i dont know how to split them
local teleporters = math.random(1,2)
if teleporters == 1 then
player.Character.Parent = 1folder
end
if teleporters == 2 then
player.Character.Parent = 2folder
end
But when math.Random pick 1 then the player move into 1 folder only
if you want to randomly put half the players characters into 1 folder and half into the other you can make a script like this
local Players = game.Players
local folder1 = workspace.Folder1
local folder2 = worlspace.Folder2
local function onPlayerAdded (player)
player.CharacterAdded:Connect(function(character)
local coin = math.random(1,2)
if coin == 1 then
character.Parent = folder1
else
character.Parent = folder2
end
end)
end
for _,player in ipairs (Players:GetPlayers()) do
task.spawn(onPlayerAdded)(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)
This script just puts a players character into a folder when their character loads (it will do it again if the character respawns)
I want to do it in the same time like
The code below will split all the players evenly, or odd depending on the table length:
For your case, you can change the players
table to PlayersService:GetPlayers()
, and use a
and b
accordingly.
local players = {'p1', 'p2', 'p3', 'p4'}
local half = math.ceil(#players / 2)
local a = {}
local b = {}
for i = 1, #players do
if (i <= half) then
table.insert(a, players[i])
else
table.insert(b, players[i])
end
end
print(unpack(a)) -- -> p1 p2 p3
print(unpack(b)) -- -> p4 p5 p6
Listen I don’t know what that means, maybe ask someone that speaks your language.
I supplied you with a simple script that puts the players character into 1 of 2 folders randomly each time the character spawns.
You can change the script to implement it the way you want.