Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local p1 = workspace:WaitForChild("Portal1")
- local p2 = workspace:WaitForChild("Portal2")
- local p1Gui = script.SurfaceGuiTemplate:Clone()
- local p1VPF = Instance.new("ViewportFrame", p1Gui)
- p1VPF.Size = UDim2.new(1, 0, 1, 0)
- local p1Cam = Instance.new("Camera", p1VPF)
- p1VPF.CurrentCamera = p1Cam
- local p2Gui = p1Gui:Clone()
- p1Gui.Parent, p2Gui.Parent = script.Parent, script.Parent
- p1Gui.Adornee, p2Gui.Adornee = p1, p2
- function createView()
- p1Gui.ViewportFrame:ClearAllChildren()
- p2Gui.ViewportFrame:ClearAllChildren()
- local cam1 = Instance.new("Camera", p1Gui.ViewportFrame)
- p1Gui.ViewportFrame.CurrentCamera = cam1
- local cam2 = Instance.new("Camera", p2Gui.ViewportFrame)
- p2Gui.ViewportFrame.CurrentCamera = cam2
- cam1.CFrame = p1.CFrame
- cam2.CFrame = p2.CFrame
- for i, child in pairs(workspace:GetChildren()) do
- if not child:IsA("Terrain") then
- child.Archivable = true
- child:Clone().Parent = p1Gui.ViewportFrame
- child:Clone().Parent = p2Gui.ViewportFrame
- end
- end
- end
- createView()
- workspace.DescendantAdded:Connect(createView)
- workspace.DescendantRemoving:Connect(createView)
- local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
- hum.Touched:Connect(function(part)
- if part == p1 then
- hum.Parent.HumanoidRootPart.CFrame = p2.TeleportPart.CFrame + Vector3.new(0, 10, 0)
- elseif part == p2 then
- hum.Parent.HumanoidRootPart.CFrame = p1.TeleportPart.CFrame + Vector3.new(0, 10, 0)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement