Advertisement
scriptingtales

Roblox Server Location Board Thing

Nov 2nd, 2023 (edited)
671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.26 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2. function sandbox(var,func)
  3.     local env = getfenv(func)
  4.     local newenv = setmetatable({},{
  5.         __index = function(self,k)
  6.             if k=="script" then
  7.                 return var
  8.             else
  9.                 return env[k]
  10.             end
  11.         end,
  12.     })
  13.     setfenv(func,newenv)
  14.     return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Part0 = Instance.new("Part")
  19. SurfaceGui1 = Instance.new("SurfaceGui")
  20. TextLabel2 = Instance.new("TextLabel")
  21. Script3 = Instance.new("Script")
  22. Part0.Name = "Board"
  23. Part0.Parent = mas
  24. Part0.CFrame = CFrame.new(16.5, 5.5, 12.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  25. Part0.Position = Vector3.new(16.5, 5.5, 12.5)
  26. Part0.Size = Vector3.new(15, 11, 1)
  27. Part0.Anchored = true
  28. Part0.BackSurface = Enum.SurfaceType.Studs
  29. Part0.BottomSurface = Enum.SurfaceType.Studs
  30. Part0.FrontSurface = Enum.SurfaceType.Studs
  31. Part0.LeftSurface = Enum.SurfaceType.Studs
  32. Part0.RightSurface = Enum.SurfaceType.Studs
  33. SurfaceGui1.Name = "GUISur"
  34. SurfaceGui1.Parent = Part0
  35. SurfaceGui1.LightInfluence = 1
  36. SurfaceGui1.ClipsDescendants = true
  37. SurfaceGui1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  38. SurfaceGui1.MaxDistance = (10^5)^2
  39. SurfaceGui1.LightInfluence = 0
  40. TextLabel2.Name = "Loc"
  41. TextLabel2.Parent = SurfaceGui1
  42. TextLabel2.Size = UDim2.new(0, 800, 0, 600)
  43. TextLabel2.BackgroundColor = BrickColor.new("Institutional white")
  44. TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
  45. TextLabel2.BorderColor = BrickColor.new("Really black")
  46. TextLabel2.BorderColor3 = Color3.new(0, 0, 0)
  47. TextLabel2.BorderSizePixel = 0
  48. TextLabel2.Font = Enum.Font.SourceSans
  49. TextLabel2.FontSize = Enum.FontSize.Size14
  50. TextLabel2.TextColor = BrickColor.new("Really black")
  51. TextLabel2.TextColor3 = Color3.new(0, 0, 0)
  52. TextLabel2.TextScaled = true
  53. TextLabel2.TextSize = 14
  54. TextLabel2.TextWrap = true
  55. TextLabel2.TextWrapped = true
  56. TextLabel2.Text = "Retrieving Server Location..."
  57. Script3.Name = "Work"
  58. Script3.Parent = Part0
  59. table.insert(cors,sandbox(Script3,function()
  60. --Made by Collin201/rnelee/Big7Rich
  61. Instance.new("RemoteEvent", game.ReplicatedStorage)
  62.  
  63.  
  64. local HttpService = game:GetService("HttpService")
  65. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  66.  
  67.  
  68.  
  69.  
  70.  
  71. local ServerUpdate = ReplicatedStorage.RemoteEvent
  72.  
  73. local Success, ErrorMessage = pcall(function()
  74.     local Response = HttpService:GetAsync("http://ip-api.com/json/", true)
  75.     local Data = HttpService:JSONDecode(Response)
  76.     local Country= Data.country
  77.     local City = Data.city
  78.     local CountryCode = Data.countryCode    -- You can change "timezone" to "country" or "countryCode"
  79.  
  80.     if Data.status == "success" then
  81.         script.Parent.GUISur.Loc.Text = "Server Location: " .. Country..", ".. City.. ", ".. CountryCode --- This tells the location
  82.         ServerUpdate:FireAllClients(Country)
  83.     end
  84. end)
  85.    
  86.    
  87.    
  88.    
  89. if not Success and not game.ReplicatedStorage.RemoteEvent then
  90.     warn("There was an error retrieving server location / RemoteEvent was not detected.")
  91.     warn(ErrorMessage)
  92.     script.Parent.GUISur.Loc.Text = "There was an error retrieving server location / RemoteEvent was not detected."
  93. end
  94. end))
  95. for i,v in pairs(mas:GetChildren()) do
  96.     v.Parent = workspace
  97.     pcall(function() v:MakeJoints() end)
  98. end
  99. mas:Destroy()
  100. for i,v in pairs(cors) do
  101.     spawn(function()
  102.         pcall(v)
  103.     end)
  104. end
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement