Need help coding a portion of my intro sequence

Hello, everyone!

I’m currently developing a new intro sequence for my game that will play at the start and end of each round. However, I’m at a bit of a problem currently - I can’t figure out how to have every player in a set pattern like so:

Some of my map’s maximum player count is 64 players, but I’d like this to be able to go on forever, in case a map has a substantially higher player count.

The jist of this would be every player would be in front of a camera, and would be able to do a taunt or some other animation while in front of the camera. After both teams are displayed, it’ll delete the “fake” characters and then start the game. Halo 5, Operation Scorpion, and Unreal Tournament 4 all have this feature. Wanting to implement it in my own game.

Any help would be greatly appreciated!

1 Like

You can clone the player, which can be done by setting the Archivable Property of the Character Model to true, and cloning it. Then you manually positioning the CFrame and Orientation of the HumanoidRootPart to face the camera.That’s just an idea though.

1 Like

I’m aware of being able to clone the player, however, I’m still unsure of how to get the players to be placed in a pattern like the blocks in the image.

You would want to make an array that contains the positions of those parts then teleport all the humanoid root parts to those positions.
https://developer.roblox.com/articles/How-to-teleport-within-a-Place

I want to refrain from it being part based because the max player counts are random.

An algorithm that is able to generate that pattern is pretty complex. Best thing is to make the pattern with the max numbers of players then turn that into an array in the order you want them to be teleported in.

local Locations = { -- Contains the locations of the parts in descending order
    location1, location2, location3, location4  -- These would be a cframe value
}

for i,Player in pairs(Players) do -- An array containing the players
    Player.Character.HumanoidRootPart.CFrame = Locations[i] -- Using the index of the player it is on
end
1 Like

The second parameter of CFrame allows you to set direction. If the cord is (0,0,0) and want them to face West, add one to the X (0,1,0)

CFrame.new(Vector3 pos, Vector3 lookAt)

http://wiki.roblox.com/index.php?title=CFrame

1 Like

Hm… I can’t figure it out either. Seems like something really complex you’re trying to achieve here.

Personally, I think I would have an idea of how to begin That’s mostly based off of the model you posted. I probably don’t have your concrete solution, but perhaps somewhere that you can begin on.

This is how I envision your current model:

The player in the red slot is an outlier and the party leader. They can be ignored and handled separately. The rest of the players are handled like a table or whatever you’d like.

Now notice the way you chose to lay it out. There’s a middle column behind the leader and each row of parts is three per row. The outside parts increasingly separate (the blue lines), but the centre column stays the same. You can envision the players behind the leader in this sort of an expression:

  • Each row after the leader is arranged in P1 P2 P3 format (Left Middle Right)
  • P2 (Middle) is in a constant single file line behind the leader
  • P1 (Left) and P3 (Right) are an offset beside P2

What you can probably do is organise the outside players to be an offset from the player in the middle, then increment that offset for use on the next row of players.

That’s the least I have a clue of. You might experience issues with my method, such as incomplete or uneven rows depending on the number of players. If that’s a non-concern for you, then I suppose this could work out somehow?

1 Like

If you want to avoid the really complex math:
Perhaps take the parts just like you have, and group in a Model
In a script, Clone the model, Set a primary part, and set the parts CFrame.
Then you can move the groups of positions however you like.
Put the positional data of each part into a table, and do things, like teleport players!

Here’s a really crude example of what I mean, without the teleporting players part.

local Model = game.Workspace.PositionTemplate 
for i=1,15 do
local newGroup = Model:Clone()
local offset = 30*i
newGroup.Name = Model.Name .. i
newGroup.Parent = Model.Parent
newGroup.PrimaryPart=newGroup.MainPart
newGroup:SetPrimaryPartCFrame(CFrame.new(Vector3.new(newGroup.PrimaryPart.Position.X+offset, newGroup.PrimaryPart.Position.Y,newGroup.PrimaryPart.Position.Z)))		
end


ManyPoints.rbxl (13.6 KB)

1 Like

Will definitely look into using this!

I’m assuming I could make it go behind the front player? That’s what I was planning on doing. :stuck_out_tongue:

2 Likes

Yes definitely. If you give each part a unique name, you can basically index each position and fine tune it.

So in the loop you could just create a table:

local TeleportPoints = {}
for i=1,15 do
TeleportPoints[i] = {} --set a new table for this group
local newGroup = Model:Clone()
local Points = Model:GetChildren()

--chose your favorite loop to iterate and add here
...
end
2 Likes

Managed to get it to work, however, the points aren’t the correct orientation:

1 Like
newGroup:SetPrimaryPartCFrame(CFrame.new(Vector3.new(newGroup.PrimaryPart.Position.X+offset, newGroup.PrimaryPart.Position.Y,newGroup.PrimaryPart.Position.Z)))

It should use the orientation of the template as is. I am not very versed with the CFrame stuff, but you should be able to tweak that line and get desired results.

3 Likes