Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local Players = game:GetService("Players")
- local TeleportService = game:GetService("TeleportService")
- -- GUI Setup
- local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
- screenGui.Name = "CustomUI"
- screenGui.ResetOnSpawn = false
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 300, 0, 240)
- frame.Position = UDim2.new(0.5, -150, 0.5, -120)
- frame.BackgroundColor3 = Color3.new(0, 0, 0)
- frame.Active = true
- frame.Draggable = true
- frame.Parent = screenGui
- local frameCorner = Instance.new("UICorner")
- frameCorner.CornerRadius = UDim.new(0, 15)
- frameCorner.Parent = frame
- local titleLabel = Instance.new("TextLabel")
- titleLabel.Size = UDim2.new(0, 300, 0, 30)
- titleLabel.Position = UDim2.new(0, 0, 0, 5)
- titleLabel.Text = "Join GUI"
- titleLabel.BackgroundTransparency = 1
- titleLabel.TextColor3 = Color3.new(1, 1, 1)
- titleLabel.Font = Enum.Font.SourceSansBold
- titleLabel.TextSize = 22
- titleLabel.Parent = frame
- local textBox = Instance.new("TextBox")
- textBox.Size = UDim2.new(0, 260, 0, 40)
- textBox.Position = UDim2.new(0, 20, 0, 40)
- textBox.PlaceholderText = "Enter player ID..."
- textBox.BackgroundColor3 = Color3.new(1, 1, 1)
- textBox.TextColor3 = Color3.new(0, 0, 0)
- textBox.Font = Enum.Font.SourceSans
- textBox.TextSize = 18
- textBox.ClearTextOnFocus = false
- textBox.Parent = frame
- local textBoxCorner = Instance.new("UICorner")
- textBoxCorner.CornerRadius = UDim.new(1, 0)
- textBoxCorner.Parent = textBox
- local joinButton = Instance.new("TextButton")
- joinButton.Size = UDim2.new(0, 120, 0, 40)
- joinButton.Position = UDim2.new(0, 20, 0, 100)
- joinButton.Text = "Join"
- joinButton.BackgroundColor3 = Color3.new(1, 1, 1)
- joinButton.TextColor3 = Color3.new(0, 0, 0)
- joinButton.Font = Enum.Font.SourceSans
- joinButton.TextSize = 18
- joinButton.Parent = frame
- local joinCorner = Instance.new("UICorner")
- joinCorner.CornerRadius = UDim.new(1, 0)
- joinCorner.Parent = joinButton
- local detectButton = Instance.new("TextButton")
- detectButton.Size = UDim2.new(0, 120, 0, 40)
- detectButton.Position = UDim2.new(0, 160, 0, 100)
- detectButton.Text = "Detect"
- detectButton.BackgroundColor3 = Color3.new(1, 1, 1)
- detectButton.TextColor3 = Color3.new(0, 0, 0)
- detectButton.Font = Enum.Font.SourceSans
- detectButton.TextSize = 18
- detectButton.Parent = frame
- local detectCorner = Instance.new("UICorner")
- detectCorner.CornerRadius = UDim.new(1, 0)
- detectCorner.Parent = detectButton
- local footerLabel = Instance.new("TextLabel")
- footerLabel.Size = UDim2.new(1, 0, 0, 30)
- footerLabel.Position = UDim2.new(0, 0, 0, 180)
- footerLabel.Text = "Made by @Rojhann"
- footerLabel.BackgroundTransparency = 1
- footerLabel.TextColor3 = Color3.new(1, 1, 1)
- footerLabel.Font = Enum.Font.SourceSansItalic
- footerLabel.TextSize = 16
- footerLabel.TextStrokeTransparency = 0.7
- footerLabel.Parent = frame
- -- Function to create status frame and auto-remove it after 3 seconds
- local function createStatusFrame(message, color)
- local statusFrame = Instance.new("Frame")
- statusFrame.Size = UDim2.new(0, 220, 0, 50)
- statusFrame.Position = UDim2.new(0.5, -110, 0.5, -160)
- statusFrame.BackgroundColor3 = Color3.new(0, 0, 0)
- statusFrame.BackgroundTransparency = 0.4
- statusFrame.Parent = screenGui
- local statusLabel = Instance.new("TextLabel")
- statusLabel.Size = UDim2.new(1, -40, 1, 0)
- statusLabel.Position = UDim2.new(0, 10, 0, 0)
- statusLabel.BackgroundTransparency = 1
- statusLabel.TextColor3 = Color3.new(1, 1, 1)
- statusLabel.Font = Enum.Font.SourceSans
- statusLabel.TextSize = 16
- statusLabel.Text = message
- statusLabel.TextXAlignment = Enum.TextXAlignment.Left
- statusLabel.Parent = statusFrame
- local statusCircle = Instance.new("Frame")
- statusCircle.Size = UDim2.new(0, 20, 0, 20)
- statusCircle.Position = UDim2.new(1, -30, 0.5, -10)
- statusCircle.BackgroundColor3 = color
- statusCircle.BorderSizePixel = 0
- statusCircle.Parent = statusFrame
- local circleCorner = Instance.new("UICorner")
- circleCorner.CornerRadius = UDim.new(1, 0)
- circleCorner.Parent = statusCircle
- task.delay(3, function()
- if statusFrame then
- statusFrame:Destroy()
- end
- end)
- end
- -- Detect Button Logic
- detectButton.MouseButton1Click:Connect(function()
- local playerId = tonumber(textBox.Text)
- if not playerId then
- createStatusFrame("Invalid Player ID", Color3.new(1, 0.5, 0))
- return
- end
- Players:GetUserThumbnailAsync(playerId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size48x48) -- force cache user
- local success, result = pcall(function()
- return Players:GetNameFromUserIdAsync(playerId)
- end)
- if success then
- local username = result
- local isOnline = false
- local target = nil
- for _, p in ipairs(Players:GetPlayers()) do
- if p.UserId == playerId then
- isOnline = true
- target = p
- break
- end
- end
- if isOnline then
- if target.Character and target.Character:FindFirstChild("HumanoidRootPart") then
- createStatusFrame(username .. " is playing", Color3.new(0, 1, 0)) -- Green
- else
- createStatusFrame(username .. " is online, not playing", Color3.fromRGB(100, 200, 255)) -- Light blue
- end
- else
- createStatusFrame(username .. " is offline", Color3.new(1, 0, 0)) -- Red
- end
- else
- createStatusFrame("Player not found", Color3.new(1, 0, 0))
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment