Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do you move different players to different spots?

I am currently working on a HG game. I am trying to move everyone in the game(or on a certain team) and move them all to different pods. I literally have no idea how to go about this and if anyone can help it will be very useful. Please! This is all have so far which is a mess.

`` players = game.Players:GetChildren()

one = players[math.random(1, #players)]:MoveTo(part.Position)
one.TeamColor = TeamColor.new("Dark blue")
	two = players[math.random(1, #players)]:MoveTo(part.Position)
two.TeamColor = TeamColor.new("Dark blue")	
	three = players[math.random(1, #players)]:MoveTo(part.Position)
three.TeamColor = TeamColor.new("Dark blue")
four = players[math.random(1, #players)]:MoveTo(part.Position)
four.TeamColor = TeamColor.new("Dark blue")

end

``

2 comments

1

if you don't know how to move a character then i wouldn't recommend spending time on such a game. i would suggest to improve your skills first and start off small projects.

0

I do know how to move a player, I just don't know how to move all of them to different spots

2 answers

✓ Accepted answer

Make a table for the parts. Make sure to put the parts in some kind of folder. Also if the player spawns inside the part then add at the end of line 10 " + Vector3.new(0,5,0)"

wait(4)

local parts = {}

for _,part in pairs(path to parts:GetChildren()) do
	table.insert(parts,part)
end

for _,plr in pairs(game.Players:GetPlayers()) do
	local partchosen = parts[math.random(1,#parts)]
	local char = plr.Character or plr.CharacterAdded:wait()
	
	char.HumanoidRootPart.CFrame = partchosen.CFrame
	for i,part in pairs(parts) do
		if part == partchosen then
			table.remove(parts,i)
		end
	end
end

3 comments

0

thats only for the moving to different spots thing

0

there is an error with the 'to' it expects a ')' to close a coulom 20 or something but I will try it!

0

zValerian i added a wait() so it has time to see the character. please consider accepting this answer

Problem Solution
You’re trying to use the MoveTo method on the Player object, which will error since the Player class doesn’t have this method. Call the MoveTo method on the Character. (Not recommended)
You’re trying to create a new TeamColor with a nonexistent global variable. The TeamColor constructor is BrickColor.new().
You used GetChildren on Players, which can error if you have items that aren’t Player objects. Use the Players:GetPlayers() method to get the children which are ONLY Player objects.

1 comment

0

Woah, how did you do this?

This discussion is preserved as it was. New answers, comments, and votes are closed.