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

How to teleport a player thats touching a teleporter?

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

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.

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