This is a localscript inside of a teleport GUI. It allows players to teleport to each other. So when a player wants to teleport to someone, it sends a request to the other player. If they accept, they’re teleported to the other player. Occasionally, it will randomly teleport a player without the request. Lastly, it will also teleport two people instead of one sometimes. It really should only be teleporting one.

local GUI=script.Parent
local Bring=GUI:WaitForChild("Bring")
local To=GUI:WaitForChild("TeleportTo")
local lplayer=script.Parent.Parent.Parent.Parent
local activ=true
local cooldown=0

function findPlayer(name)
	for i,v in pairs(game.Players:GetPlayers()) do
		if v.Name:sub(1,#name):lower() == name:lower() then
			return v
		end
	end
end

Bring.GO.MouseButton1Down:connect(function()
	if activ == true then
		if #Bring.TextBox.Text < 1 then print(""..Bring.TextBox.Text) return end
		local player = findPlayer(Bring.TextBox.Text)
		if player.Name~=lplayer.Name then ----- Attempt to index a Local Player
			local num=15
			player.PlayerGui.TeleportLine.Teleport.Visible = true
			player.PlayerGui.TeleportLine.Teleport.Request.Visible = true
			coroutine.resume(coroutine.create(function()
				repeat
					player.PlayerGui.TeleportLine.Teleport.Request.Request.Text = lplayer.Name..' Wants to Bring you '..num
					num=num-1
					wait(1)
				until num == 0
				player.PlayerGui.TeleportLine.Teleport.Request.Request.Text = ""
				player.PlayerGui.TeleportLine.Teleport.Request.Visible = false
			end))
			player.PlayerGui.TeleportLine.Teleport.Request.Yes.MouseButton1Down:connect(function()
				num = 0
				player.Character.HumanoidRootPart.CFrame=lplayer.Character.HumanoidRootPart.CFrame*CFrame.new()
			end)
			player.PlayerGui.TeleportLine.Teleport.Request.No.MouseButton1Down:connect(function()
				player.PlayerGui.TeleportLine.Teleport.Request.Visible=false
			end)
			cooldown=30
			activ=false
			repeat
				Bring.TextBox.Text=cooldown..""
				wait(1)
				cooldown=cooldown-1
			until cooldown==0
			activ=true
		end
	end
end)

To.GO.MouseButton1Down:connect(function()
	if activ == true then
		if #To.TextBox.Text < 1 then print(""..To.TextBox.Text) return end
		local player = findPlayer(To.TextBox.Text)
		if player.Name~=player.Name then ----- Attempt to index a Local Player
			local num=15
			player.PlayerGui.TeleportLine.Teleport.Visible = true
			player.PlayerGui.TeleportLine.Teleport.Request.Visible = true
			coroutine.resume(coroutine.create(function()
				repeat
					player.PlayerGui.TeleportLine.Teleport.Request.Request.Text = lplayer.Name..' Wants to Teleport to you '..num
					num=num-1
					wait(1)
				until num == 0
				player.PlayerGui.TeleportLine.Teleport.Request.Request.Text = ""
				player.PlayerGui.TeleportLine.Teleport.Request.Visible = false
			end))
			player.PlayerGui.TeleportLine.Teleport.Request.Yes.MouseButton1Down:connect(function()
				num = 0
				lplayer.Character.HumanoidRootPart.CFrame=player.Character.HumanoidRootPart.CFrame*CFrame.new()
			end)
			player.PlayerGui.TeleportLine.Teleport.Request.No.MouseButton1Down:connect(function()
				player.PlayerGui.TeleportLine.Teleport.Request.Visible=false
			end)
			cooldown=30
			activ=false
			repeat
				To.TextBox.Text=cooldown..""
				wait(1)
				cooldown=cooldown-1
			until cooldown==0
			activ=true
		end
	end
end)
end)