Rojhann10

Untitled

May 9th, 2025
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local Players = game:GetService("Players")
  3. local TeleportService = game:GetService("TeleportService")
  4.  
  5. -- GUI Setup
  6. local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
  7. screenGui.Name = "CustomUI"
  8. screenGui.ResetOnSpawn = false
  9.  
  10. local frame = Instance.new("Frame")
  11. frame.Size = UDim2.new(0, 300, 0, 240)
  12. frame.Position = UDim2.new(0.5, -150, 0.5, -120)
  13. frame.BackgroundColor3 = Color3.new(0, 0, 0)
  14. frame.Active = true
  15. frame.Draggable = true
  16. frame.Parent = screenGui
  17.  
  18. local frameCorner = Instance.new("UICorner")
  19. frameCorner.CornerRadius = UDim.new(0, 15)
  20. frameCorner.Parent = frame
  21.  
  22. local titleLabel = Instance.new("TextLabel")
  23. titleLabel.Size = UDim2.new(0, 300, 0, 30)
  24. titleLabel.Position = UDim2.new(0, 0, 0, 5)
  25. titleLabel.Text = "Join GUI"
  26. titleLabel.BackgroundTransparency = 1
  27. titleLabel.TextColor3 = Color3.new(1, 1, 1)
  28. titleLabel.Font = Enum.Font.SourceSansBold
  29. titleLabel.TextSize = 22
  30. titleLabel.Parent = frame
  31.  
  32. local textBox = Instance.new("TextBox")
  33. textBox.Size = UDim2.new(0, 260, 0, 40)
  34. textBox.Position = UDim2.new(0, 20, 0, 40)
  35. textBox.PlaceholderText = "Enter player ID..."
  36. textBox.BackgroundColor3 = Color3.new(1, 1, 1)
  37. textBox.TextColor3 = Color3.new(0, 0, 0)
  38. textBox.Font = Enum.Font.SourceSans
  39. textBox.TextSize = 18
  40. textBox.ClearTextOnFocus = false
  41. textBox.Parent = frame
  42.  
  43. local textBoxCorner = Instance.new("UICorner")
  44. textBoxCorner.CornerRadius = UDim.new(1, 0)
  45. textBoxCorner.Parent = textBox
  46.  
  47. local joinButton = Instance.new("TextButton")
  48. joinButton.Size = UDim2.new(0, 120, 0, 40)
  49. joinButton.Position = UDim2.new(0, 20, 0, 100)
  50. joinButton.Text = "Join"
  51. joinButton.BackgroundColor3 = Color3.new(1, 1, 1)
  52. joinButton.TextColor3 = Color3.new(0, 0, 0)
  53. joinButton.Font = Enum.Font.SourceSans
  54. joinButton.TextSize = 18
  55. joinButton.Parent = frame
  56.  
  57. local joinCorner = Instance.new("UICorner")
  58. joinCorner.CornerRadius = UDim.new(1, 0)
  59. joinCorner.Parent = joinButton
  60.  
  61. local detectButton = Instance.new("TextButton")
  62. detectButton.Size = UDim2.new(0, 120, 0, 40)
  63. detectButton.Position = UDim2.new(0, 160, 0, 100)
  64. detectButton.Text = "Detect"
  65. detectButton.BackgroundColor3 = Color3.new(1, 1, 1)
  66. detectButton.TextColor3 = Color3.new(0, 0, 0)
  67. detectButton.Font = Enum.Font.SourceSans
  68. detectButton.TextSize = 18
  69. detectButton.Parent = frame
  70.  
  71. local detectCorner = Instance.new("UICorner")
  72. detectCorner.CornerRadius = UDim.new(1, 0)
  73. detectCorner.Parent = detectButton
  74.  
  75. local footerLabel = Instance.new("TextLabel")
  76. footerLabel.Size = UDim2.new(1, 0, 0, 30)
  77. footerLabel.Position = UDim2.new(0, 0, 0, 180)
  78. footerLabel.Text = "Made by @Rojhann"
  79. footerLabel.BackgroundTransparency = 1
  80. footerLabel.TextColor3 = Color3.new(1, 1, 1)
  81. footerLabel.Font = Enum.Font.SourceSansItalic
  82. footerLabel.TextSize = 16
  83. footerLabel.TextStrokeTransparency = 0.7
  84. footerLabel.Parent = frame
  85.  
  86. -- Function to create status frame and auto-remove it after 3 seconds
  87. local function createStatusFrame(message, color)
  88. local statusFrame = Instance.new("Frame")
  89. statusFrame.Size = UDim2.new(0, 220, 0, 50)
  90. statusFrame.Position = UDim2.new(0.5, -110, 0.5, -160)
  91. statusFrame.BackgroundColor3 = Color3.new(0, 0, 0)
  92. statusFrame.BackgroundTransparency = 0.4
  93. statusFrame.Parent = screenGui
  94.  
  95. local statusLabel = Instance.new("TextLabel")
  96. statusLabel.Size = UDim2.new(1, -40, 1, 0)
  97. statusLabel.Position = UDim2.new(0, 10, 0, 0)
  98. statusLabel.BackgroundTransparency = 1
  99. statusLabel.TextColor3 = Color3.new(1, 1, 1)
  100. statusLabel.Font = Enum.Font.SourceSans
  101. statusLabel.TextSize = 16
  102. statusLabel.Text = message
  103. statusLabel.TextXAlignment = Enum.TextXAlignment.Left
  104. statusLabel.Parent = statusFrame
  105.  
  106. local statusCircle = Instance.new("Frame")
  107. statusCircle.Size = UDim2.new(0, 20, 0, 20)
  108. statusCircle.Position = UDim2.new(1, -30, 0.5, -10)
  109. statusCircle.BackgroundColor3 = color
  110. statusCircle.BorderSizePixel = 0
  111. statusCircle.Parent = statusFrame
  112.  
  113. local circleCorner = Instance.new("UICorner")
  114. circleCorner.CornerRadius = UDim.new(1, 0)
  115. circleCorner.Parent = statusCircle
  116.  
  117. task.delay(3, function()
  118. if statusFrame then
  119. statusFrame:Destroy()
  120. end
  121. end)
  122. end
  123.  
  124. -- Detect Button Logic
  125. detectButton.MouseButton1Click:Connect(function()
  126. local playerId = tonumber(textBox.Text)
  127. if not playerId then
  128. createStatusFrame("Invalid Player ID", Color3.new(1, 0.5, 0))
  129. return
  130. end
  131.  
  132. Players:GetUserThumbnailAsync(playerId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size48x48) -- force cache user
  133.  
  134. local success, result = pcall(function()
  135. return Players:GetNameFromUserIdAsync(playerId)
  136. end)
  137.  
  138. if success then
  139. local username = result
  140. local isOnline = false
  141. local target = nil
  142.  
  143. for _, p in ipairs(Players:GetPlayers()) do
  144. if p.UserId == playerId then
  145. isOnline = true
  146. target = p
  147. break
  148. end
  149. end
  150.  
  151. if isOnline then
  152. if target.Character and target.Character:FindFirstChild("HumanoidRootPart") then
  153. createStatusFrame(username .. " is playing", Color3.new(0, 1, 0)) -- Green
  154. else
  155. createStatusFrame(username .. " is online, not playing", Color3.fromRGB(100, 200, 255)) -- Light blue
  156. end
  157. else
  158. createStatusFrame(username .. " is offline", Color3.new(1, 0, 0)) -- Red
  159. end
  160. else
  161. createStatusFrame("Player not found", Color3.new(1, 0, 0))
  162. end
  163. end)
Advertisement
Add Comment
Please, Sign In to add comment