Advertisement
scriptingtales

Roblox Player Location When Join

Mar 9th, 2024 (edited)
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 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(-0.5, 5.49999714, -0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  25. Part0.Position = Vector3.new(-0.5, 5.499997138977051, -0.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.ClipsDescendants = true
  36. SurfaceGui1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  37. SurfaceGui1.MaxDistance = 10000000000
  38. TextLabel2.Name = "Loc"
  39. TextLabel2.Parent = SurfaceGui1
  40. TextLabel2.Size = UDim2.new(0, 800, 0, 600)
  41. TextLabel2.BackgroundColor = BrickColor.new("Institutional white")
  42. TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
  43. TextLabel2.BorderColor = BrickColor.new("Really black")
  44. TextLabel2.BorderColor3 = Color3.new(0, 0, 0)
  45. TextLabel2.BorderSizePixel = 0
  46. TextLabel2.Font = Enum.Font.SourceSans
  47. TextLabel2.FontSize = Enum.FontSize.Size14
  48. TextLabel2.Text = "Waiting for new players..."
  49. TextLabel2.TextColor = BrickColor.new("Really black")
  50. TextLabel2.TextColor3 = Color3.new(0, 0, 0)
  51. TextLabel2.TextScaled = true
  52. TextLabel2.TextSize = 14
  53. TextLabel2.TextWrap = true
  54. TextLabel2.TextWrapped = true
  55. Script3.Name = "Work"
  56. Script3.Parent = Part0
  57. table.insert(cors,sandbox(Script3,function()
  58. local Players = game:GetService("Players")
  59. local HttpService = game:GetService("HttpService")
  60. local LocalizationService = game:GetService("LocalizationService")
  61. local Countries = {}
  62.  
  63. local success, result = pcall(function()
  64.     return HttpService:GetAsync("http://country.io/names.json")
  65. end)
  66.  
  67. if success and result then
  68.     Countries = HttpService:JSONDecode(result)
  69. end
  70.  
  71. Players.PlayerAdded:Connect(function(player)
  72.     local success, code = pcall(LocalizationService.GetCountryRegionForPlayerAsync, LocalizationService, player)
  73.     if success and code then
  74.         TextLabel2.Text = player.DisplayName .." is from ".. Countries[code]
  75.     end
  76. end)
  77. end))
  78. for i,v in pairs(mas:GetChildren()) do
  79.     v.Parent = workspace
  80.     pcall(function() v:MakeJoints() end)
  81. end
  82. mas:Destroy()
  83. for i,v in pairs(cors) do
  84.     spawn(function()
  85.         pcall(v)
  86.     end)
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement