CHoff719

Untitled

Jun 5th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1.  
  2. local Network = {}
  3. Network.Settings = {}
  4. Network.Settings.Parent = workspace.Terrain
  5.  
  6. function Network.start(name)
  7. local Folder = Instance.new("Folder")
  8. Folder.Name = name
  9. Folder.Parent = Network.Settings.Parent
  10. end
  11.  
  12. function Network.connect(Server, ply)
  13. local Folder = Network.Settings.Parent[Server]
  14. if Folder then
  15. local Data = Instance.new("Folder")
  16. Data.Name = ply.Name
  17. Data.Parent = Folder
  18. return Data
  19. end
  20. end
  21.  
  22. local Player = game:GetService("Players").LocalPlayer
  23. repeat wait() until Player.Character
  24.  
  25. local Screen = Instance.new("ScreenGui")
  26. Screen.Parent = Player:WaitForChild("PlayerGui")
  27.  
  28. local function ud(x, y)
  29. return UDim2.new(0, x, 0, y)
  30. end
  31.  
  32. local Box = Instance.new("TextBox")
  33. Box.Size = ud(200, 200)
  34. Box.ClearTextOnFocus = false
  35. Box.MultiLine = true
  36. Box.Text = "print'Hello world!'"
  37. Box.TextXAlignment = Enum.TextXAlignment.Left
  38. Box.TextYAlignment = Enum.TextYAlignment.Top
  39. Box.Parent = Screen
  40.  
  41. local Server = "Potato"
  42.  
  43. if Network.Settings.Parent:FindFirstChild(Server) == nil then
  44. Network.start(Server)
  45. end
  46.  
  47. local Connection = Network.connect(Server, Player)
  48.  
  49. function newStat(className, name, value)
  50. local Stat = Instance.new(className)
  51. Stat.Name = name
  52. Stat.Value = value
  53. Stat.Parent = Connection
  54. return Stat
  55. end
  56.  
  57.  
  58. local up = newStat("BoolValue", "Updated", false)
  59. local str = newStat("StringValue", "Text", "")
  60.  
  61. local updated = false
  62. Box.Changed:connect(function(value)
  63. if value == "Text" and updated == false then
  64. up.Value = true
  65. str.Value = Box.Text
  66. end
  67. end)
  68.  
  69. game:GetService("RunService").RenderStepped:connect(function()
  70. for k,v in pairs(Network.Settings.Parent[Server]:GetChildren()) do
  71. if v.Name ~= Player.Name then
  72. if v.Updated.Value == true then
  73. updated = true
  74. Box.Text = v.Text.Value
  75. updated = false
  76. v.Updated.Value = false
  77. end
  78. end
  79. end
  80. end)
Advertisement
Add Comment
Please, Sign In to add comment