Advertisement
scriptingtales

Roblox random IP address generator and geolocator

Mar 28th, 2024
1,612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.72 KB | None | 0 0
  1. Part0 = Instance.new("Part")
  2. SurfaceGui1 = Instance.new("SurfaceGui")
  3. Frame2 = Instance.new("Frame")
  4. TextLabel3 = Instance.new("TextLabel")
  5.  
  6. TextLabel5 = Instance.new("TextLabel")
  7. TextLabel300 = Instance.new("TextLabel")
  8. TextLabel7 = Instance.new("TextLabel")
  9. TextButton8 = Instance.new("TextButton")
  10.  
  11.  
  12.  
  13.  
  14. Part0.Name = "IP"
  15. Part0.Parent = script
  16. Part0.CFrame = CFrame.new(0, 5.99999714, -32.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  17. Part0.Position = Vector3.new(0, 5.999997138977051, -32.5)
  18. Part0.Size = Vector3.new(18, 12, 1)
  19. Part0.Anchored = true
  20. Part0.BackSurface = Enum.SurfaceType.Studs
  21. Part0.BottomSurface = Enum.SurfaceType.Studs
  22. Part0.FrontSurface = Enum.SurfaceType.Studs
  23. Part0.LeftSurface = Enum.SurfaceType.Studs
  24. Part0.RightSurface = Enum.SurfaceType.Studs
  25. SurfaceGui1.Parent = Part0
  26. SurfaceGui1.ClipsDescendants = true
  27. SurfaceGui1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  28. SurfaceGui1.Adornee = Part0
  29. Frame2.Parent = SurfaceGui1
  30. Frame2.Size = UDim2.new(0, 900, 0, 600)
  31. Frame2.Active = true
  32. Frame2.BackgroundColor = BrickColor.new("Institutional white")
  33. Frame2.BackgroundColor3 = Color3.new(1, 1, 1)
  34. Frame2.BorderColor = BrickColor.new("Institutional white")
  35. Frame2.BorderColor3 = Color3.new(1, 1, 1)
  36. Frame2.Draggable = true
  37. Frame2.Selectable = true
  38. TextLabel3.Name = "FrameLabel"
  39. TextLabel3.Parent = Frame2
  40. TextLabel3.Size = UDim2.new(0, 900, 0, 100)
  41. TextLabel3.BackgroundColor = BrickColor.new("Institutional white")
  42. TextLabel3.BackgroundColor3 = Color3.new(1, 1, 1)
  43. TextLabel3.BorderColor = BrickColor.new("Institutional white")
  44. TextLabel3.BorderColor3 = Color3.new(1, 1, 1)
  45. TextLabel3.Font = Enum.Font.SourceSansLight
  46. TextLabel3.FontSize = Enum.FontSize.Size48
  47. TextLabel3.Text = "IP Geolocation Converter"
  48. TextLabel3.TextColor = BrickColor.new("Really black")
  49. TextLabel3.TextColor3 = Color3.new(0, 0, 0)
  50. TextLabel3.TextScaled = true
  51. TextLabel3.TextSize = 38
  52. TextLabel3.TextWrap = true
  53. TextLabel3.TextWrapped = true
  54.  
  55.  
  56.  
  57.  
  58. Frame2.Selectable = false
  59. Frame2.Active = false
  60. Frame2.Draggable = false
  61.  
  62.  
  63. if Frame2.Draggable == false and Frame2.Active == false and Frame2.Selectable == false then
  64.     print("Yes")
  65. else
  66.     print("No")
  67. end
  68.  
  69.  
  70.  
  71. TextLabel5.Name = "Credits"
  72. TextLabel5.Parent = Frame2
  73. TextLabel5.Position = UDim2.new(0, 650, 0, 550)
  74. TextLabel5.Size = UDim2.new(0, 250, 0, 50)
  75. TextLabel5.BackgroundColor = BrickColor.new("Institutional white")
  76. TextLabel5.BackgroundColor3 = Color3.new(1, 1, 1)
  77. TextLabel5.BorderColor = BrickColor.new("Institutional white")
  78. TextLabel5.BorderColor3 = Color3.new(1, 1, 1)
  79. TextLabel5.Font = Enum.Font.Unknown
  80. TextLabel5.FontSize = Enum.FontSize.Size48
  81. TextLabel5.Text = "Credits to: Kaiji#7888"
  82. TextLabel5.TextColor = BrickColor.new("Dark grey")
  83. TextLabel5.TextColor3 = Color3.new(0.407843, 0.411765, 0.411765)
  84. TextLabel5.TextScaled = true
  85. TextLabel5.TextSize = 38
  86. TextLabel5.TextWrap = true
  87. TextLabel5.TextWrapped = true
  88. TextLabel300.Name = "IpInserter"
  89. TextLabel300.Parent = Frame2
  90. TextLabel300.Position = UDim2.new(0, 300, 0, 125)
  91. TextLabel300.Size = UDim2.new(0, 300, 0, 75)
  92. TextLabel300.BackgroundColor = BrickColor.new("Institutional white")
  93. TextLabel300.BackgroundColor3 = Color3.new(1, 1, 1)
  94. TextLabel300.BorderColor = BrickColor.new("Really black")
  95. TextLabel300.BorderColor3 = Color3.new(0, 0, 0)
  96. TextLabel300.BorderSizePixel = 0
  97. TextLabel300.Font = Enum.Font.SourceSansLight
  98. TextLabel300.FontSize = Enum.FontSize.Size14
  99. TextLabel300.Text = "Click to generate random IP"
  100. TextLabel300.TextColor = BrickColor.new("Really black")
  101. TextLabel300.TextColor3 = Color3.new(0, 0, 0)
  102. TextLabel300.TextScaled = true
  103. TextLabel300.TextSize = 14
  104. TextLabel300.TextWrap = true
  105. TextLabel300.TextWrapped = true
  106. TextLabel7.Name = "ShowLoc"
  107. TextLabel7.Parent = Frame2
  108. TextLabel7.Position = UDim2.new(0, 175, 0, 250)
  109. TextLabel7.Size = UDim2.new(0, 550, 0, 125)
  110. TextLabel7.BackgroundColor = BrickColor.new("Institutional white")
  111. TextLabel7.BackgroundColor3 = Color3.new(1, 1, 1)
  112. TextLabel7.BorderColor = BrickColor.new("Institutional white")
  113. TextLabel7.BorderColor3 = Color3.new(1, 1, 1)
  114. TextLabel7.Font = Enum.Font.SourceSansLight
  115. TextLabel7.FontSize = Enum.FontSize.Size48
  116. TextLabel7.Text = "Location will show here..."
  117. TextLabel7.TextColor = BrickColor.new("Really black")
  118. TextLabel7.TextColor3 = Color3.new(0, 0, 0)
  119. TextLabel7.TextScaled = true
  120. TextLabel7.TextSize = 38
  121. TextLabel7.TextWrap = true
  122. TextLabel7.TextWrapped = true
  123. TextButton8.Name = "DecodeIP"
  124. TextButton8.Parent = Frame2
  125. TextButton8.Position = UDim2.new(0.36500001, 0, 0.701666653, 0)
  126. TextButton8.Size = UDim2.new(0, 250, 0, 100)
  127. TextButton8.BackgroundColor = BrickColor.new("Silver flip/flop")
  128. TextButton8.BackgroundColor3 = Color3.new(0.533333, 0.533333, 0.533333)
  129. TextButton8.Font = Enum.Font.SourceSansLight
  130. TextButton8.FontSize = Enum.FontSize.Size14
  131. TextButton8.Text = "Generate and get IP Geolocation"
  132. TextButton8.TextColor = BrickColor.new("Institutional white")
  133. TextButton8.TextColor3 = Color3.new(1, 1, 1)
  134. TextButton8.TextScaled = true
  135. TextButton8.TextSize = 14
  136. TextButton8.TextWrap = true
  137. TextButton8.TextWrapped = true
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145. local function IpAd()
  146.    
  147.    
  148.    
  149.     -- Function to generate a random number between min and max
  150.     local function random(min, max)
  151.         return math.random(min, max)
  152.     end
  153.  
  154.     -- Function to generate a random IP address
  155.     local function generateRandomIP()
  156.         local ip = ""
  157.         for i = 1, 4 do
  158.             ip = ip .. random(0, 255)
  159.             if i < 4 then
  160.                 ip = ip .. "."
  161.             end
  162.         end
  163.         return ip
  164.     end
  165.  
  166.    
  167.     math.randomseed(os.time())
  168.  
  169.    
  170.     TextLabel300.Text = generateRandomIP()
  171.  
  172.  
  173.     local HttpService = game:GetService("HttpService")
  174.     local Success, ErrorMessage = pcall(function()
  175.         local Response = HttpService:GetAsync("http://ip-api.com/json/".. TextLabel300.Text, true)
  176.         local Data = HttpService:JSONDecode(Response)
  177.         local Country= Data.country
  178.         local City = Data.city
  179.         local CountryRegion = Data.region    -- You can change "timezone" to "country" or "countryCode"
  180.  
  181.         if Data.status == "success" then
  182.             TextLabel7.Text = Country..", ".. City.. " in ".. CountryRegion.. " region" --- This tells the location
  183.         end
  184.  
  185.  
  186.         if not TextLabel300.Text then
  187.             TextLabel7.Text = "No Location"
  188.         end
  189.  
  190.     end)
  191.  
  192.  
  193. end
  194.  
  195. TextButton8.MouseButton1Up:Connect(IpAd)
  196.  
  197. UICorner0 = Instance.new("UICorner")
  198. UICorner1 = Instance.new("UICorner")
  199. UIStroke0 = Instance.new("UIStroke")
  200.  
  201. if Part0.Position ~= Vector3.new(0, 6, 22.5) then
  202.     Part0.Position = Vector3.new(0, 6, 22.5)
  203. end
  204.  
  205. TextLabel5.FontFace.Style = Enum.FontStyle.Italic
  206. TextLabel5.FontFace.Weight = Enum.FontWeight.Light
  207.  
  208. UICorner0.Parent = TextLabel300
  209. UIStroke0.Parent = TextLabel300
  210. UIStroke0.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  211. UICorner1.Parent = TextButton8
  212. SurfaceGui1.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement