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

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

Asked by
BryanFehr 133
5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by 5 years ago

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.

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. BryanFehr 133 — 5y
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. Ashley_Phantom 372 — 5y
0
Okay sweet. BryanFehr 133 — 5y
Ad

Answer this question