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

How do i make a game teleport that teleports the player when e is pressed?

Asked by 4 years ago

i made a game teleport that works then the player touched it but i wanted to make one that has a BillboardGui that says press e to enter and when you press e you go to the diffrent game.

here is the script that i have is it possible to change it around to that when e is pressed it teleports the player?

local TeleportService = game:GetService("TeleportService")
local gameID = "3562975575"    -- Game ID--

function onTouched(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        TeleportService:Teleport(gameID, player)
    end
end

script.Parent.Touched:connect(onTouched)

Answer this question