Advertisement
TheUnknownDiscord

Viewport

Sep 7th, 2021 (edited)
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. part1 = Instance.new("Part", game.Workspace)
  2. part1.Size = Vector3.new(10,10,0.05)
  3. part1.Anchored = true
  4. part1.Position = Vector3.new(20,5,0)
  5. part1.Reflectance = 1
  6. local screengui = Instance.new("SurfaceGui",owner.PlayerGui)
  7. screengui.Adornee = part1
  8. local viewportFrame = Instance.new("ViewportFrame",screengui)
  9. local viewportCamera = Instance.new("Camera",viewportFrame)
  10. test = Instance.new("RemoteEvent",owner.PlayerGui)
  11. game.Players.PlayerAdded:Connect(function(a)
  12. local screengui = screengui:Clone()
  13. screengui.Parent = a.PlayerGui
  14. screengui.Name = "hello"
  15. viewportFrame.Size = UDim2.new(1, 0, 1, 0)
  16. viewportFrame.Position = UDim2.new(0,0,0,0)
  17. viewportFrame.Name = "gaming"
  18. for i,v in pairs(game.Workspace:GetDescendants()) do
  19. if v:IsA("BasePart") or v:IsA("Decal") then
  20. if not v:IsA("Terrain") then
  21. local part = v:Clone()
  22. part.Parent = viewportFrame
  23. screengui.Adornee = part1
  24. viewportFrame.CurrentCamera = viewportCamera
  25. end
  26. end
  27. end
  28. test.OnServerEvent:Connect(function(player,cf)
  29. local s, f = pcall(function()
  30. viewportCamera.CFrame = cf
  31. end)
  32. end)
  33. end)
  34. local s, f = pcall(function()
  35. for i, a in pairs(game.Players:GetChildren()) do
  36. if a:IsA("Player") then
  37. local screengui = screengui:Clone()
  38. screengui.Parent = a.PlayerGui
  39. screengui.Name = "hello"
  40. viewportFrame.Size = UDim2.new(1, 0, 1, 0)
  41. viewportFrame.Position = UDim2.new(0,0,0,0)
  42. viewportFrame.Name = "gaming"
  43. for i,v in pairs(game.Workspace:GetDescendants()) do
  44. if v:IsA("BasePart") or v:IsA("Decal") then
  45. if not v:IsA("Terrain") then
  46. local part = v:Clone()
  47. part.Parent = viewportFrame
  48. screengui.Adornee = part1
  49. viewportFrame.CurrentCamera = viewportCamera
  50. end
  51. end
  52. end
  53. end
  54. test.OnServerEvent:Connect(function(player,cf)
  55. local s, f = pcall(function()
  56. viewportCamera.CFrame = cf
  57. end)
  58. end)
  59. end
  60. end)
  61. local s, f = pcall(function()
  62. for i,v in pairs(game.Workspace:GetDescendants()) do
  63. if v:IsA("BasePart") or v:IsA("Decal") then
  64. if not v:IsA("Terrain") then
  65. local part = v:Clone()
  66. part.Parent = viewportFrame
  67. screengui.Face = Enum.NormalId.Front
  68. viewportFrame.BackgroundTransparency = 1
  69. end
  70. end
  71. end
  72. end)
  73. while true do
  74. for i,v in pairs(game.Workspace:GetDescendants()) do
  75. if v:IsA("BasePart") then
  76. if not v:IsA("Terrain") then
  77. cf = v.CFrame
  78. viewportCamera.CFrame = owner.Character.Torso.CFrame
  79. task.wait()
  80. end
  81. end
  82. end
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement