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

Teleport to other game after certain amount of players is touching brick?

Hello all! I was simply wondering, is there a way to make this teleport script able to detect if a certain amount of players are touching a brick, then teleport those players to a different game, sort of like Prison Royale.

    local TeleportService = game:GetService("TeleportService") 
    local Place = 0 
    script.Parent.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
    TeleportService:Teleport(Place, player)
    end
    end)

1 answer

✓ Accepted answer

Hi there, excuse my minimal brain activity because it's way past midnight here and I'm supposed to be sleeping. Anyways,

You can achieve this by having 2 type of hitboxes, one which adds a player to a table when the player touches it, and another which removes the player from the table, which is then used to get the list of people that the script is going to teleport, I'm pretty sure that this is how that battle royale game you mentioned works.

3 comments

0

How would I go about coding that using my script? As I am new to the matter, and don't quite understand what you mean.

0

Parts have the .Touched() event which is fired when a basepart collides with it, it gives you an argument which is the basepart that it collided with, you can check the Wiki for "BasePart", the Players service in game is also very useful as it even allows you to get a Player just by using their character.

0

Okay sweet.

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