game.ReplicatedStorage.DoFancyTeleport.OnClientEvent:Connect(function(M,C)if script.Parent:FindFirstAncestorOfClass("\087\111\114\107\115\112\097\099\101")then return end if C==nil then C=true end local F=game.Players.LocalPlayer.Character if not F then return end local Q=F:FindFirstChild("\085\112\112\101\114\084\111\114\115\111")if not Q then Q=F:FindFirstChild("\084\111\114\115\111")end if not Q then return end if db then return end db=true if C then script.Parent.Visible=true script.Parent.BackgroundTransparency=1 local M={BackgroundTransparency=0}local C=TweenService:Create(script.Parent,info,M)C:Play()wait(FadeTime)end if Q then local t=F:FindFirstChild("\072\117\109\097\110\111\105\100")if t then t.Sit=false end if typeof(M)=="\086\101\099\116\111\114\051"then Q.CFrame=(Q.CFrame-Q.CFrame.p)+M elseif typeof(M)=="\073\110\115\116\097\110\099\101"then if M:IsA("\066\097\115\101\080\097\114\116")then Q.CFrame=M.CFrame+Vector3.new(0,M.Size.Y/2+3,0)workspace.CurrentCamera.Focus=Q.CFrame workspace.CurrentCamera.CFrame=Q.CFrame*CFrame.new(0,5,-10)end end if C then wait(BlackoutTime)end end if C then local M={BackgroundTransparency=1}local C=TweenService:Create(script.Parent,info,M)C:Play()wait(FadeTime)script.Parent.Visible=false end wait(DelayTime)db=false end)


game.ReplicatedStorage.DoFancyTeleport.OnClientEvent:Connect(function(destination, fade)
	if script.Parent:FindFirstAncestorOfClass("Workspace") then return end --Just in case studio test runs LocalScripts in places where it's not supposed to...
	if fade==nil then fade = true end
	local character = game.Players.LocalPlayer.Character
	if not character then return end
	local torso = character:FindFirstChild("UpperTorso")
	if not torso then
		torso = character:FindFirstChild("Torso")
	end
	if not torso then return end
	if db then return end
	db=true
	if fade then
		script.Parent.Visible = true
		script.Parent.BackgroundTransparency = 1
		local targ = {BackgroundTransparency = 0}
		local tween = TweenService:Create(script.Parent, info, targ)
		tween:Play()
		wait(FadeTime)
	end
	if torso then
		local hum = character:FindFirstChild("Humanoid")
		if hum then hum.Sit = false end
		if typeof(destination) == "Vector3" then
			torso.CFrame = torso.CFrame - torso.CFrame.p + destination
		elseif typeof(destination) == "Instance" then
			if destination:IsA("BasePart") then
				torso.CFrame = destination.CFrame + Vector3.new(0, destination.Size.Y/2 + 3, 0) --1 for the lower torso, 2 for the legs...
				workspace.CurrentCamera.Focus = torso.CFrame
				workspace.CurrentCamera.CFrame = torso.CFrame * CFrame.new(0, 5, -10)
			end
		end
		if fade then
			wait(BlackoutTime)
		end
	end
	if fade then
		local targ = {BackgroundTransparency = 1}
		local tween = TweenService:Create(script.Parent, info, targ)
		tween:Play()
		wait(FadeTime)
		script.Parent.Visible = false
	end
	wait(DelayTime)
	db = false
end)
