Multiplayer Animation Radius

How would I go about making a party system where once a GUI button is clicked, it spawns a circle around the player which other players can go into and once within that radius it adds them to the list of party members and the leader of the party can kick players with another button next to their username. You also can’t enter the radius once it has 6 players in it as the max. After a countdown of lets say 10 seconds, all the players in the radius/party will play an animation that’s different depending on how many people are in the party and is a different animation for each person. Some parts I’m able to figure out myself such as the GUI clicks and playing the animation but for others I’m clueless.

1 Like

Well first you want to figure how you’re going to detect players within the radius. You could use raycasting, regions, touched, or even a simple magnitude check on every players character.

There’s also the new spatial query api that just released not to long ago:

IMO the simpliest approach would just be to have an actual sphere and simply call WorldRoot:GetPartsInPart(Part, OverlapParams) on it. This will return a list of parts within the sphere → simply loop through it and check if its an actual player.

As for kicking or joining the party. Just create a table for anyone who joins → if the party is full or you kick someone out just remove them from said table. You could also have a blacklist table that you add players who were kicked to (so they can’t just keep walking back in and joining). And just have an if statement during the :GetPartsInPart() loop that checks to see if the player within the sphere is in the blacklist table or not (or you could just send it as a blacklist with OverlapParams).

Lastly, once the timer is up. Loop through your list of players and just play whatever animation you want.

As for visuals, just do them on the client → if a player is blacklisted simply disable all effects for them (such as SurfaceUIs or the actual circle radius).