Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

how do you move different players to different spots?

Asked by
zValerian 108
5 years ago

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

``

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. luachef 61 — 5y
0
I do know how to move a player, I just don't know how to move all of them to different spots zValerian 108 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
0
thats only for the moving to different spots thing Gavinboy3000 98 — 5y
0
there is an error with the 'to' it expects a ')' to close a coulom 20 or something but I will try it! zValerian 108 — 5y
0
zValerian i added a wait() so it has time to see the character. please consider accepting this answer Gavinboy3000 98 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
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.
0
Woah, how did you do this? saSlol2436 716 — 5y

Answer this question