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

How to teleport a player thats touching a teleporter?

Asked by 7 years ago
Edited 7 years ago

I am trying to write a script that'll tp a player to the desired location, I want to make it admins of the game backwards and forwards, only though that we dont have lua admin installed so i will have to do it the long way. can u guys help me out? It works, but I want it to only be able to teleport the admins stated bellow. PLs help me. The admins are Soulbeastpro49 (my second account) and ObsiDIEan00. Here's the code:

function teleportPlayer(pos, torso)
    local char = torso
    char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))
end -- close the function here

script.Parent.Touched:connect(function(part)
    teleportPlayer(Vector3.new(-905, 108.7, 136), part.Parent.Torso)
end)

Thanks! Jerry

1 answer

Log in to vote
0
Answered by
Bulvyte 388 Moderation Voter
7 years ago
Edited 7 years ago

Today im in a good mood, so i'll help.

Also u took my teleporter script > : (

admins = ("Player1"),("Player2") -- if u want only to be one put this line: admins = ("namehere")

repeat wait() until game.Players.LocalPlayer and
game.Players.LocalPlayer.Character
function teleportPlayer(pos, torso)
    local char = torso
    char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))
end

script.Parent.Touched:connect(function(part)
    local Name = part.Parent.Name
    if Name == admins then
        print("Admin teleported!")
   teleportPlayer(Vector3.new(-905, 108.7, 136), part.Parent.Torso)
else
    if Name ~= admins then
    print("NO ADMIN TOUCHING TELEPORTER > : (")
    return end
    end
end)

Good luck! if i helped accept da answer button.

Ad

Answer this question