--LobbyUI LocalScript

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local JoinLobby = ReplicatedStorage.RemoteEvents.JoinLobby
local LeaveLobby = ReplicatedStorage.RemoteEvents.LeaveLobby
local UpdateLobby = ReplicatedStorage.RemoteEvents.UpdateLobby

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = playerGui:WaitForChild("LobbyUI")
local mainFrame = screenGui:WaitForChild("MainFrame")
local buttonFrame = mainFrame:WaitForChild("ButtonFrame")
local infoLabel = mainFrame:WaitForChild("InfoLabel")
local lobbyFrame = screenGui:WaitForChild("LobbyFrame")
local leaveButton = lobbyFrame:WaitForChild("LeaveButton")
local rosterFrame = lobbyFrame:WaitForChild("RosterFrame")
local countdownLabel = lobbyFrame:WaitForChild("CountdownLabel")

for _, child in ipairs(buttonFrame:GetChildren()) do
	if child:IsA("TextButton") then
		child.MouseButton1Click:Connect(function()
			JoinLobby:FireServer(child.Name:gsub("Button",""))
		end)
	end
end

leaveButton.MouseButton1Click:Connect(function()
	if lobbyFrame.Visible and lobbyFrame:GetAttribute("Mode") then
		LeaveLobby:FireServer(lobbyFrame:GetAttribute("Mode"))
		lobbyFrame.Visible = false
		mainFrame.Visible = true
	end
end)

UpdateLobby.OnClientEvent:Connect(function(mode, playerData, countdown)
	mainFrame.Visible = false
	lobbyFrame.Visible = true
	lobbyFrame:SetAttribute("Mode", mode)

	for _, child in ipairs(rosterFrame:GetChildren()) do
		if child:IsA("Frame") then child:Destroy() end
	end

	for _, data in ipairs(playerData) do
		local item = Instance.new("Frame")
		item.Size = UDim2.new(1, 0, 0, 60)
		item.BackgroundTransparency = 1
		item.Parent = rosterFrame

		local thumb = Instance.new("ImageLabel")
		thumb.Size = UDim2.new(0, 50, 0, 50)
		thumb.Position = UDim2.new(0, 5, 0.5, -25)
		thumb.BackgroundTransparency = 1
		thumb.Parent = item

		local content, _ = Players:GetUserThumbnailAsync(data.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
		thumb.Image = content

		local nameLabel = Instance.new("TextLabel")
		nameLabel.Size = UDim2.new(1, -60, 1, 0)
		nameLabel.Position = UDim2.new(0, 60, 0, 0)
		nameLabel.Text = data.DisplayName .. " (@" .. data.Username .. ")"
		nameLabel.TextScaled = true
		nameLabel.TextColor3 = Color3.fromRGB(255,255,255)
		nameLabel.BackgroundTransparency = 1
		nameLabel.TextXAlignment = Enum.TextXAlignment.Left
		nameLabel.Parent = item
	end

	local current = #playerData
	local capacities = {
		["1v1"] = 2,
		["2v2"] = 4,
		["4v4"] = 8,
		["10v10"] = 20,
		["20v20"] = 40,
	}
	local max = capacities[mode] or 0

	if countdown then
		countdownLabel.Text = "Match starting in " .. countdown .. "s (" .. current .. "/" .. max .. ")"
	else
		countdownLabel.Text = "Waiting for players... (" .. current .. "/" .. max .. ")"
	end
end)

--StarterPlayerScripts DisableMovement

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local function disableMovement()
	humanoid.WalkSpeed = 0
	humanoid.JumpPower = 0
	humanoid.UseJumpPower = true

	UserInputService.InputBegan:Connect(function(input, gameProcessed)
		if gameProcessed then return end
		if input.UserInputType == Enum.UserInputType.Keyboard then
			local blocked = {
				[Enum.KeyCode.W] = true,
				[Enum.KeyCode.A] = true,
				[Enum.KeyCode.S] = true,
				[Enum.KeyCode.D] = true,
				[Enum.KeyCode.Space] = true,
				[Enum.KeyCode.Up] = true,
				[Enum.KeyCode.Down] = true,
				[Enum.KeyCode.Left] = true,
				[Enum.KeyCode.Right] = true,
			}
			if blocked[input.KeyCode] then
			end
		end
	end)
end

disableMovement()
player.CharacterAdded:Connect(function(char)
	character = char
	humanoid = character:WaitForChild("Humanoid")
	disableMovement()
end)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: