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

How do you make a camping teleporter?

Asked by 3 years ago

( a teleport er to a game where you can only join it by the lobby but not from a homepage or web) I am needing help on making a teleporter for my group game, so its easier to link the stats instead of making separate games. Does anyone know how to do this? Please tell me if you know, FYI I'm not that introduced to scripting so please tell me what to do with the info you give me and where to put it. Thanks!

1 answer

Log in to vote
0
Answered by 3 years ago

make a new game and check if teleport data is nil. If it is nil it will kick the player from the game meaning they joined manually. You can do this with:

plr:GetJoinData()

Here is the code you need:

game.Players.PlayerAdded:Connect(function(plr)
    local JoinData = plr:GetJoinData()
    local TeleportData = JoinData.TeleportData
    local SourcePlaceId = JoinData.SourcePlaceId
    if SourcePlaceId == nil or SourcePlaceId ~= JoinData[1] then
        plr:Kick('Please join from the lobby instead of the website.')
    end
end)

That should check if the player joined manually instead of from a teleport. Hope this helped!

Ad

Answer this question