Join player gui
Key Required

Join player gui

99 Nights in the Forest 🔦OnlyThePowerOnlyThePower 8.3K views 1.1K executesUpdated Nov 8, 2025
Unrated
00
Lua Script•199 lines (6489 chars)
-- Services
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer

-- GUI Setup Compact
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "JoinPlayerGuiCompact"
ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
ScreenGui.ResetOnSpawn = false

local MainFrame = Instance.new("Frame")
MainFrame.Size = UDim2.new(0, 240, 0, 160) -- sedikit lebih tinggi untuk space bar bawah
MainFrame.Position = UDim2.new(0.5, -120, 0.5, -80)
MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
MainFrame.BorderSizePixel = 0
MainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.Parent = ScreenGui

local MainCorner = Instance.new("UICorner")
MainCorner.CornerRadius = UDim.new(0, 12)
MainCorner.Parent = MainFrame

-- Rainbow Border
local Border = Instance.new("UIStroke")
Border.Thickness = 3
Border.Parent = MainFrame
RunService.RenderStepped:Connect(function()
    local time = tick() * 2
    Border.Color = Color3.fromHSV((time % 1), 1, 1)
end)

-- Close Button
local CloseBtn = Instance.new("TextButton")
CloseBtn.Size = UDim2.new(0, 25, 0, 25)
CloseBtn.Position = UDim2.new(1, -30, 0, 5)
CloseBtn.BackgroundTransparency = 1
CloseBtn.Text = "X"
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.TextSize = 18
CloseBtn.TextColor3 = Color3.fromRGB(255, 80, 80)
CloseBtn.Parent = MainFrame
CloseBtn.MouseButton1Click:Connect(function()
    ScreenGui:Destroy()
end)

-- Title
local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, -40, 0, 25)
Title.Position = UDim2.new(0, 10, 0, 5)
Title.BackgroundTransparency = 1
Title.Text = "Join Player"
Title.Font = Enum.Font.GothamBold
Title.TextSize = 18
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextXAlignment = Enum.TextXAlignment.Left
Title.Parent = MainFrame

-- Username Input
local UsernameBox = Instance.new("TextBox")
UsernameBox.Size = UDim2.new(0.8, 0, 0, 25)
UsernameBox.Position = UDim2.new(0.1, 0, 0.22, 0)
UsernameBox.PlaceholderText = "Enter username"
UsernameBox.Text = ""
UsernameBox.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
UsernameBox.TextColor3 = Color3.fromRGB(255, 255, 255)
UsernameBox.ClearTextOnFocus = false
UsernameBox.Font = Enum.Font.Gotham
UsernameBox.TextSize = 14
UsernameBox.Parent = MainFrame

local InputCorner = Instance.new("UICorner")
InputCorner.CornerRadius = UDim.new(0, 10)
InputCorner.Parent = UsernameBox

-- Join Button
local JoinBtn = Instance.new("TextButton")
JoinBtn.Size = UDim2.new(0.8, 0, 0, 35)
JoinBtn.Position = UDim2.new(0.1, 0, 0.45, 0)
JoinBtn.BackgroundColor3 = Color3.fromRGB(85, 170, 255)
JoinBtn.Text = "Join"
JoinBtn.Font = Enum.Font.GothamBold
JoinBtn.TextSize = 16
JoinBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
JoinBtn.Parent = MainFrame

local BtnCorner = Instance.new("UICorner")
BtnCorner.CornerRadius = UDim.new(0, 10)
BtnCorner.Parent = JoinBtn

-- Status Label
local StatusLabel = Instance.new("TextLabel")
StatusLabel.Size = UDim2.new(1, -20, 0, 22)
StatusLabel.Position = UDim2.new(0, 10, 0.7, 0)
StatusLabel.BackgroundTransparency = 1
StatusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
StatusLabel.Font = Enum.Font.Gotham
StatusLabel.TextSize = 14
StatusLabel.Text = ""
StatusLabel.TextXAlignment = Enum.TextXAlignment.Center
StatusLabel.Parent = MainFrame

-- Modern Rainbow Time Bar (di bawah frame)
local TimeBarBG = Instance.new("Frame")
TimeBarBG.Size = UDim2.new(0.8, 0, 0, 6)
TimeBarBG.Position = UDim2.new(0.1, 0, 0.88, 0) -- posisi di bawah status label
TimeBarBG.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
TimeBarBG.Parent = MainFrame

local TimeBar = Instance.new("Frame")
TimeBar.Size = UDim2.new(0, 0, 1, 0)
TimeBar.BackgroundColor3 = Color3.fromRGB(85, 170, 255)
TimeBar.Parent = TimeBarBG

local TimeBarCorner = Instance.new("UICorner")
TimeBarCorner.CornerRadius = UDim.new(0, 4)
TimeBarCorner.Parent = TimeBar

local TimeBarStroke = Instance.new("UIStroke")
TimeBarStroke.Thickness = 2
TimeBarStroke.Parent = TimeBar
RunService.RenderStepped:Connect(function()
    local time = tick() * 2
    TimeBarStroke.Color = Color3.fromHSV((time % 1), 1, 1)
end)

local function updateTimeBar(progress)
    TimeBar:TweenSize(UDim2.new(math.clamp(progress,0,1),0,1,0), "Out", "Sine", 0.2, true)
end

-- Join player function
local function joinPlayerByUsername(username)
    if username == "" then
        StatusLabel.Text = "Please enter a username!"
        updateTimeBar(0)
        return
    end
    if LocalPlayer.Name:lower() == username:lower() then
        StatusLabel.Text = "You are already this player!"
        updateTimeBar(1)
        return
    end

    StatusLabel.Text = "Checking current server..."
    updateTimeBar(0.1)
    task.wait(0.4)

    for _, p in pairs(Players:GetPlayers()) do
        if p.Name:lower() == username:lower() then
            StatusLabel.Text = "Player is already in this server!"
            updateTimeBar(1)
            return
        end
    end

    StatusLabel.Text = "Searching other servers..."
    updateTimeBar(0.3)
    task.wait(0.5)

    local cursor
    local found = false
    while true do
        local success, servers = pcall(function()
            local url = "https://games.roblox.com/v1/games/"..game.PlaceId.."/servers/Public?limit=100"
            if cursor then url = url.."&cursor="..cursor end
            return HttpService:JSONDecode(game:HttpGet(url))
        end)

        if success and servers and servers.data and #servers.data > 0 then
            for i, server in pairs(servers.data) do
                if server.id ~= game.JobId and server.playing > 0 then
                    StatusLabel.Text = "Trying next server..."
                    updateTimeBar(0.3 + 0.6*(i/#servers.data))
                    task.wait(0.3)
                    pcall(function()
                        TeleportService:TeleportToPlaceInstance(game.PlaceId, server.id, LocalPlayer)
                    end)
                    found = true
                    break
                end
            end
            cursor = servers.nextPageCursor
            if found then break end
        else
            StatusLabel.Text = "Wrong username!"
            updateTimeBar(1)
            break
        end
    end
end

-- Connect Join Button
JoinBtn.MouseButton1Click:Connect(function()
    joinPlayerByUsername(UsernameBox.Text)
end)

Features & Information

Can be used for all games
#teleportgui

Community Comments (0)

No comments yet for this script.

More Scripts for 99 Nights in the Forest 🔦