slap dules x3r hub
Key Required

slap dules x3r hub

Slap DUELS [🎉UPD!]x3rscriptsx3rscripts 841 views 490 executesUpdated Mar 12, 2026
Unrated
00
Lua Script•1954 lines (52531 chars)
--// X3R - DULES Advanced Panel
--// LocalScript only
--// Place in StarterPlayer > StarterPlayerScripts
--// No RemoteEvent / No RemoteFunction

--==================================================
-- SERVICES
--==================================================
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Lighting = game:GetService("Lighting")

--==================================================
-- PLAYER
--==================================================
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

--==================================================
-- CONFIG
--==================================================
local CONFIG = {
	KEY = "DULES",

	UI_SIZE = UDim2.new(0, 460, 0, 345),
	UI_CLOSED_SIZE = UDim2.new(0, 460, 0, 0),

	KEY_SIZE = UDim2.new(0, 360, 0, 225),
	KEY_CLOSED_SIZE = UDim2.new(0, 360, 0, 0),

	FLOAT_SIZE = UDim2.new(0, 58, 0, 58),

	BLUR_SIZE = 0, -- [EDIT 1] Blur removed: was 18, now 0

	WALKSPEED = 50,

	ANIM_FAST = 0.12,
	ANIM_MED = 0.22,
	ANIM_SLOW = 0.30,

	FLY_SPEED = 75,
	JUMPPOWER_DEFAULT = 50,
	JUMPPOWER_MIN = 25,
	JUMPPOWER_MAX = 200,
	JUMPPOWER_STEP = 25,
}

local COLORS = {
	BG = Color3.fromRGB(9, 9, 9),
	BG2 = Color3.fromRGB(14, 14, 14),
	PANEL = Color3.fromRGB(18, 18, 18),
	PANEL2 = Color3.fromRGB(24, 24, 24),
	PANEL3 = Color3.fromRGB(29, 29, 29),

	RED = Color3.fromRGB(220, 32, 32),
	RED2 = Color3.fromRGB(160, 20, 20),
	RED3 = Color3.fromRGB(90, 14, 14),

	WHITE = Color3.fromRGB(245, 245, 245),
	LIGHT = Color3.fromRGB(205, 205, 205),
	GRAY = Color3.fromRGB(145, 145, 145),
	DARKGRAY = Color3.fromRGB(100, 100, 100),

	SUCCESS = Color3.fromRGB(90, 255, 125),
	ERROR = Color3.fromRGB(255, 90, 90),
	WARN = Color3.fromRGB(255, 190, 80),
}

--==================================================
-- STATE
--==================================================
local unlocked = false
local uiOpen = false
local currentTab = "Actions"
local currentWalkspeedBoosted = false

local flyEnabled = false
local flyBV = nil
local flyBG = nil
local flyConnection = nil
local antiRagdollEnabled = false
local antiRagdollConnection = nil
local currentJumpPower = CONFIG.JUMPPOWER_DEFAULT

local flyMove = {
	W = false,
	A = false,
	S = false,
	D = false,
	Up = false,
	Down = false,
}

--==================================================
-- UTILS
--==================================================
local function create(className, props, children)
	local instance = Instance.new(className)
	for k, v in pairs(props or {}) do
		instance[k] = v
	end
	for _, child in ipairs(children or {}) do
		child.Parent = instance
	end
	return instance
end

local function makeCorner(obj, radius)
	local c = Instance.new("UICorner")
	c.CornerRadius = radius or UDim.new(0, 12)
	c.Parent = obj
	return c
end

local function makeStroke(obj, color, thickness, transparency)
	local s = Instance.new("UIStroke")
	s.Color = color or COLORS.RED
	s.Thickness = thickness or 1.4
	s.Transparency = transparency or 0
	s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
	s.Parent = obj
	return s
end

local function makePadding(obj, left, right, top, bottom)
	local p = Instance.new("UIPadding")
	p.PaddingLeft = UDim.new(0, left or 0)
	p.PaddingRight = UDim.new(0, right or 0)
	p.PaddingTop = UDim.new(0, top or 0)
	p.PaddingBottom = UDim.new(0, bottom or 0)
	p.Parent = obj
	return p
end

local function tween(obj, info, props)
	if typeof(obj) ~= "Instance" then return end

	local success, tw = pcall(function()
		return TweenService:Create(obj, info, props)
	end)

	if success and tw then
		tw:Play()
		return tw
	end
end

local function fastTween(obj, props)
	return tween(obj, TweenInfo.new(CONFIG.ANIM_FAST, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), props)
end

local function medTween(obj, props)
	return tween(obj, TweenInfo.new(CONFIG.ANIM_MED, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), props)
end

local function slowTween(obj, props)
	return tween(obj, TweenInfo.new(CONFIG.ANIM_SLOW, Enum.EasingStyle.Back, Enum.EasingDirection.Out), props)
end

local function pulse(button)
	local originalSize = button.Size
	local shrink = UDim2.new(originalSize.X.Scale, originalSize.X.Offset - 4, originalSize.Y.Scale, originalSize.Y.Offset - 2)

	tween(button, TweenInfo.new(0.07, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
		Size = shrink
	})

	task.delay(0.08, function()
		if button and button.Parent then
			tween(button, TweenInfo.new(0.10, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
				Size = originalSize
			})
		end
	end)
end

local function popOpen(frame, targetSize)
	frame.Size = UDim2.new(targetSize.X.Scale, targetSize.X.Offset, 0, 0)
	frame.Visible = true
	slowTween(frame, {Size = targetSize})
end

local function shake(frame)
	local base = frame.Position
	local seq = {
		UDim2.new(base.X.Scale, base.X.Offset - 8, base.Y.Scale, base.Y.Offset),
		UDim2.new(base.X.Scale, base.X.Offset + 8, base.Y.Scale, base.Y.Offset),
		UDim2.new(base.X.Scale, base.X.Offset - 6, base.Y.Scale, base.Y.Offset),
		UDim2.new(base.X.Scale, base.X.Offset + 6, base.Y.Scale, base.Y.Offset),
		UDim2.new(base.X.Scale, base.X.Offset - 3, base.Y.Scale, base.Y.Offset),
		base,
	}

	local delayAmount = 0
	for _, pos in ipairs(seq) do
		task.delay(delayAmount, function()
			if frame and frame.Parent then
				tween(frame, TweenInfo.new(0.04, Enum.EasingStyle.Linear), {Position = pos})
			end
		end)
		delayAmount += 0.04
	end
end

local function hoverButton(button, normalColor, hoverColor, shine)
	button.MouseEnter:Connect(function()
		medTween(button, {BackgroundColor3 = hoverColor})
		if shine then
			tween(shine, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
				Position = UDim2.new(1, 12, 0, 0),
				BackgroundTransparency = 0.89
			})
		end
	end)

	button.MouseLeave:Connect(function()
		medTween(button, {BackgroundColor3 = normalColor})
		if shine then
			shine.Position = UDim2.new(0, -70, 0, 0)
			shine.BackgroundTransparency = 0.95
		end
	end)
end

local function makeDraggable(frame, handle)
	handle = handle or frame

	local dragging = false
	local dragStart
	local startPos
	local currentTarget = frame.Position
	local currentVisual = frame.Position

	handle.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			dragging = true
			dragStart = input.Position
			startPos = currentTarget

			input.Changed:Connect(function()
				if input.UserInputState == Enum.UserInputState.End then
					dragging = false
				end
			end)
		end
	end)

	UserInputService.InputChanged:Connect(function(input)
		if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
			local delta = input.Position - dragStart
			currentTarget = UDim2.new(
				startPos.X.Scale, startPos.X.Offset + delta.X,
				startPos.Y.Scale, startPos.Y.Offset + delta.Y
			)
		end
	end)

	RunService.RenderStepped:Connect(function(dt)
		local alpha = math.clamp(dt * 20, 0, 1)
		currentVisual = currentVisual:Lerp(currentTarget, alpha)
		frame.Position = currentVisual
	end)
end

local function getCharacter()
	return LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
end

local function getHumanoidAndRoot()
	local character = getCharacter()
	local humanoid = character:FindFirstChildOfClass("Humanoid") or character:WaitForChild("Humanoid")
	local root = character:FindFirstChild("HumanoidRootPart") or character:WaitForChild("HumanoidRootPart")
	return humanoid, root
end

local function formatStatus(label, text, color)
	label.Text = text
	label.TextColor3 = color
	label.TextTransparency = 1
	tween(label, TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
		TextTransparency = 0
	})
end

local function fadeStatus(label, delayTime)
	task.delay(delayTime or 1.5, function()
		if label and label.Parent then
			tween(label, TweenInfo.new(0.22, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
				TextTransparency = 1
			})
		end
	end)
end

local function setBottomStatus(text, color)
	statusBar.Text = text
	statusBar.TextColor3 = color or COLORS.GRAY
end

local function findNearestPartByName(name)
	local _, root = getHumanoidAndRoot()
	local nearest = nil
	local nearestDistance = math.huge

	for _, obj in ipairs(workspace:GetDescendants()) do
		if obj:IsA("BasePart") and obj.Name == name then
			local distance = (obj.Position - root.Position).Magnitude
			if distance < nearestDistance then
				nearestDistance = distance
				nearest = obj
			end
		end
	end

	return nearest, nearestDistance
end

local function teleportToNearest(name)
	local _, root = getHumanoidAndRoot()
	local part = findNearestPartByName(name)
	if part then
		root.CFrame = part.CFrame + Vector3.new(0, 3, 0)
		return true
	end
	return false
end

local function applyJumpPower(value)
	local humanoid = getHumanoidAndRoot()
	if humanoid then
		currentJumpPower = math.clamp(value, CONFIG.JUMPPOWER_MIN, CONFIG.JUMPPOWER_MAX)
		humanoid.UseJumpPower = true
		humanoid.JumpPower = currentJumpPower
		return true
	end
	return false
end

local function getThumbnail(userId)
	local ok, content = pcall(function()
		local thumb, _ = Players:GetUserThumbnailAsync(
			userId,
			Enum.ThumbnailType.HeadShot,
			Enum.ThumbnailSize.Size100x100
		)
		return thumb
	end)

	if ok and content then
		return content
	end

	return "rbxasset://textures/ui/GuiImagePlaceholder.png"
end

--==================================================
-- EFFECTS
--==================================================-- Dummy blur object to prevent Tween errors
local blur = Instance.new("Frame")
blur.Name = "DummyBlur"
blur.BackgroundTransparency = 1
blur.Size = UDim2.new(0,0,0,0)
blur.Parent = gui

--==================================================
-- GUI ROOT
--==================================================
local gui = create("ScreenGui", {
	Name = "X3R_DULES_ADVANCED",
	ResetOnSpawn = false,
	IgnoreGuiInset = false,
	ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
	Parent = PlayerGui
})

--==================================================
-- KEY WINDOW
--==================================================
local keyFrame = create("Frame", {
	Name = "KeyFrame",
	AnchorPoint = Vector2.new(0.5, 0.5),
	Position = UDim2.fromScale(0.5, 0.5),
	Size = CONFIG.KEY_CLOSED_SIZE,
	BackgroundColor3 = COLORS.PANEL,
	BorderSizePixel = 0,
	ClipsDescendants = true,
	Parent = gui
})
makeCorner(keyFrame, UDim.new(0, 18))
makeStroke(keyFrame, COLORS.RED, 1.8, 0)

local keyGlow = create("Frame", {
	Name = "KeyGlow",
	BackgroundColor3 = COLORS.RED,
	BackgroundTransparency = 0.90,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -10, 0, -10),
	Size = UDim2.new(1, 20, 1, 20),
	Parent = keyFrame
})
makeCorner(keyGlow, UDim.new(0, 22))

local keyTopBar = create("Frame", {
	Name = "TopBar",
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Size = UDim2.new(1, 0, 0, 42),
	Parent = keyFrame
})
makeCorner(keyTopBar, UDim.new(0, 18))

local keyTopFix = create("Frame", {
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 0, 0, 20),
	Size = UDim2.new(1, 0, 0, 22),
	Parent = keyTopBar
})

local keyBrand = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 14, 0, 0),
	Size = UDim2.new(1, -20, 1, 0),
	Text = "X3R • ACCESS",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 15,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = keyTopBar
})

local keyContent = create("Frame", {
	Name = "Content",
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 16, 0, 52),
	Size = UDim2.new(1, -32, 1, -64),
	Parent = keyFrame
})

local keyTitle = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 0, 0, 0),
	Size = UDim2.new(1, 0, 0, 34),
	Text = "ENTER KEY",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBlack,
	TextSize = 28,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = keyContent
})

local keySubtitle = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 0, 0, 30),
	Size = UDim2.new(1, 0, 0, 20),
	Text = "Unlock advanced local panel",
	TextColor3 = COLORS.GRAY,
	Font = Enum.Font.Gotham,
	TextSize = 13,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = keyContent
})

local keyInputFrame = create("Frame", {
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 0, 0, 74),
	Size = UDim2.new(1, 0, 0, 48),
	Parent = keyContent
})
makeCorner(keyInputFrame, UDim.new(0, 12))
makeStroke(keyInputFrame, COLORS.RED3, 1.2, 0)

local keyIcon = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 12, 0, 0),
	Size = UDim2.new(0, 28, 1, 0),
	Text = "🔑",
	TextScaled = false,
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 18,
	Parent = keyInputFrame
})

local keyBox = create("TextBox", {
	Name = "KeyBox",
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 42, 0, 0),
	Size = UDim2.new(1, -52, 1, 0),
	PlaceholderText = "Type key here...",
	Text = "",
	TextColor3 = COLORS.WHITE,
	PlaceholderColor3 = COLORS.DARKGRAY,
	Font = Enum.Font.Gotham,
	TextSize = 16,
	ClearTextOnFocus = false,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = keyInputFrame
})

local confirmButton = create("TextButton", {
	Name = "ConfirmButton",
	BackgroundColor3 = COLORS.RED2,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 0, 0, 132),
	Size = UDim2.new(1, 0, 0, 46),
	Text = "CONFIRM",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 16,
	AutoButtonColor = false,
	Parent = keyContent
})
makeCorner(confirmButton, UDim.new(0, 12))
makeStroke(confirmButton, COLORS.RED, 1.4, 0)

local keyConfirmShine = create("Frame", {
	BackgroundColor3 = Color3.new(1, 1, 1),
	BackgroundTransparency = 0.95,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -70, 0, 0),
	Size = UDim2.new(0, 60, 1, 0),
	Parent = confirmButton
})
makeCorner(keyConfirmShine, UDim.new(0, 12))
hoverButton(confirmButton, COLORS.RED2, Color3.fromRGB(180, 28, 28), keyConfirmShine)

local keyStatus = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 0, 1, -18),
	Size = UDim2.new(1, 0, 0, 18),
	Text = "",
	TextTransparency = 1,
	TextColor3 = COLORS.ERROR,
	Font = Enum.Font.GothamMedium,
	TextSize = 13,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = keyContent
})

--==================================================
-- MAIN WINDOW
--==================================================
local mainFrame = create("Frame", {
	Name = "MainFrame",
	AnchorPoint = Vector2.new(0.5, 0.5),
	Position = UDim2.fromScale(0.5, 0.5),
	Size = CONFIG.UI_CLOSED_SIZE,
	BackgroundColor3 = COLORS.PANEL,
	BorderSizePixel = 0,
	Visible = false,
	ClipsDescendants = true,
	Parent = gui
})
makeCorner(mainFrame, UDim.new(0, 18))
makeStroke(mainFrame, COLORS.RED, 1.8, 0)

local mainGlow = create("Frame", {
	Name = "MainGlow",
	BackgroundColor3 = COLORS.RED,
	BackgroundTransparency = 0.91,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -12, 0, -12),
	Size = UDim2.new(1, 24, 1, 24),
	Parent = mainFrame
})
makeCorner(mainGlow, UDim.new(0, 24))

local topBar = create("Frame", {
	Name = "TopBar",
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Size = UDim2.new(1, 0, 0, 42),
	Parent = mainFrame
})
makeCorner(topBar, UDim.new(0, 18))

local topBarFix = create("Frame", {
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 0, 0, 20),
	Size = UDim2.new(1, 0, 0, 22),
	Parent = topBar
})

local brand = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 14, 0, 0),
	Size = UDim2.new(1, -90, 1, 0),
	Text = "X3R • DULES PANEL",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 16,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = topBar
})

local closeButton = create("TextButton", {
	Name = "CloseButton",
	AnchorPoint = Vector2.new(1, 0.5),
	Position = UDim2.new(1, -10, 0.5, 0),
	Size = UDim2.new(0, 28, 0, 28),
	BackgroundColor3 = COLORS.RED3,
	BorderSizePixel = 0,
	Text = "×",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 18,
	AutoButtonColor = false,
	Parent = topBar
})
makeCorner(closeButton, UDim.new(1, 0))
makeStroke(closeButton, COLORS.RED, 1.2, 0)
hoverButton(closeButton, COLORS.RED3, Color3.fromRGB(120, 22, 22))

local body = create("Frame", {
	Name = "Body",
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 12, 0, 54),
	Size = UDim2.new(1, -24, 1, -66),
	Parent = mainFrame
})

-- LEFT SIDEBAR
local sidebar = create("Frame", {
	Name = "Sidebar",
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 0, 0, 0),
	Size = UDim2.new(0, 128, 1, 0),
	Parent = body
})
makeCorner(sidebar, UDim.new(0, 14))
makeStroke(sidebar, COLORS.RED3, 1.2, 0)

local sideTitle = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 12, 0, 10),
	Size = UDim2.new(1, -24, 0, 24),
	Text = "MENU",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 14,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = sidebar
})

local sideSub = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 12, 0, 29),
	Size = UDim2.new(1, -24, 0, 18),
	Text = "Advanced local UI",
	TextColor3 = COLORS.GRAY,
	Font = Enum.Font.Gotham,
	TextSize = 11,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = sidebar
})

local tabsHolder = create("Frame", {
	Name = "TabsHolder",
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 8, 0, 58),
	Size = UDim2.new(1, -16, 1, -70),
	Parent = sidebar
})

local tabsLayout = create("UIListLayout", {
	Padding = UDim.new(0, 8),
	FillDirection = Enum.FillDirection.Vertical,
	HorizontalAlignment = Enum.HorizontalAlignment.Center,
	VerticalAlignment = Enum.VerticalAlignment.Top,
	Parent = tabsHolder
})

-- RIGHT CONTENT
local contentFrame = create("Frame", {
	Name = "ContentFrame",
	BackgroundColor3 = COLORS.PANEL2,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 140, 0, 0),
	Size = UDim2.new(1, -140, 1, 0),
	Parent = body
})
makeCorner(contentFrame, UDim.new(0, 14))
makeStroke(contentFrame, COLORS.RED3, 1.2, 0)

local contentHeader = create("Frame", {
	Name = "Header",
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 16, 0, 10),
	Size = UDim2.new(1, -32, 0, 52),
	Parent = contentFrame
})

local contentTitle = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 0, 0, 0),
	Size = UDim2.new(1, 0, 0, 28),
	Text = "TRY BOTH !",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBlack,
	TextSize = 28,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = contentHeader
})

local contentSub = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 0, 0, 28),
	Size = UDim2.new(1, 0, 0, 18),
	Text = "Teleport and speed controls",
	TextColor3 = COLORS.GRAY,
	Font = Enum.Font.Gotham,
	TextSize = 12,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = contentHeader
})

local pageContainer = create("Frame", {
	Name = "PageContainer",
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 16, 0, 70),
	Size = UDim2.new(1, -32, 1, -102),
	Parent = contentFrame
})

statusBar = create("TextLabel", {
	Name = "StatusBar",
	BackgroundTransparency = 1,
	AnchorPoint = Vector2.new(0, 1),
	Position = UDim2.new(0, 16, 1, -10),
	Size = UDim2.new(1, -32, 0, 18),
	Text = "Ready",
	TextColor3 = COLORS.GRAY,
	Font = Enum.Font.GothamMedium,
	TextSize = 12,
	TextXAlignment = Enum.TextXAlignment.Left,
	TextTransparency = 0.15,
	Parent = contentFrame
})

--==================================================
-- FLOAT BUTTON
--==================================================
local openButton = create("TextButton", {
	Name = "OpenButton",
	Size = CONFIG.FLOAT_SIZE,
	Position = UDim2.new(0, 36, 0.62, 0),
	BackgroundColor3 = COLORS.RED2,
	BorderSizePixel = 0,
	Text = "X3R",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 14,
	Visible = false,
	AutoButtonColor = false,
	Parent = gui
})
makeCorner(openButton, UDim.new(1, 0))
makeStroke(openButton, COLORS.RED, 1.5, 0)

local openGlow = create("Frame", {
	BackgroundColor3 = COLORS.RED,
	BackgroundTransparency = 0.91,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -8, 0, -8),
	Size = UDim2.new(1, 16, 1, 16),
	Parent = openButton
})
makeCorner(openGlow, UDim.new(1, 0))

hoverButton(openButton, COLORS.RED2, Color3.fromRGB(182, 28, 28))
makeDraggable(openButton, openButton)

--==================================================
-- DRAG
--==================================================
makeDraggable(keyFrame, keyTopBar)
makeDraggable(mainFrame, topBar)

--==================================================
-- PAGES / TABS
--==================================================
local pages = {}

local function createPage(name)
	local page = create("Frame", {
		Name = name .. "Page",
		BackgroundTransparency = 1,
		Size = UDim2.new(1, 0, 1, 0),
		Visible = false,
		Parent = pageContainer
	})
	pages[name] = page
	return page
end

local actionsPage = createPage("Actions")
local infoPage = createPage("Info")

-- [EDIT 2] Player Tools page is now a ScrollingFrame for scrolling support
local playerToolsPage = create("ScrollingFrame", {
	Name = "PlayerToolsPage",
	BackgroundTransparency = 1,
	Size = UDim2.new(1, 0, 1, 0),
	Visible = false,
	CanvasSize = UDim2.new(0, 0, 0, 0),
	AutomaticCanvasSize = Enum.AutomaticSize.Y,
	ScrollBarThickness = 4,
	ScrollBarImageColor3 = COLORS.RED,
	ScrollingDirection = Enum.ScrollingDirection.Y,
	BorderSizePixel = 0,
	Parent = pageContainer
})
pages["PlayerTools"] = playerToolsPage

local function makeTabButton(text, iconText)
	local button = create("TextButton", {
		BackgroundColor3 = COLORS.PANEL3,
		BorderSizePixel = 0,
		Size = UDim2.new(1, 0, 0, 42),
		Text = "",
		AutoButtonColor = false,
		Parent = tabsHolder
	})
	makeCorner(button, UDim.new(0, 10))
	local stroke = makeStroke(button, COLORS.RED3, 1.2, 0)

	local icon = create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 10, 0, 0),
		Size = UDim2.new(0, 24, 1, 0),
		Text = iconText,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 16,
		Parent = button
	})

	local label = create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 34, 0, 0),
		Size = UDim2.new(1, -40, 1, 0),
		Text = text,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 13,
		TextXAlignment = Enum.TextXAlignment.Left,
		Parent = button
	})

	local shine = create("Frame", {
		BackgroundColor3 = Color3.new(1, 1, 1),
		BackgroundTransparency = 0.95,
		BorderSizePixel = 0,
		Position = UDim2.new(0, -60, 0, 0),
		Size = UDim2.new(0, 48, 1, 0),
		Parent = button
	})
	makeCorner(shine, UDim.new(0, 10))

	return button, stroke, shine
end

local actionsTab, actionsTabStroke, actionsShine = makeTabButton("Actions", "⚡")
local infoTab, infoTabStroke, infoShine = makeTabButton("Info", "ℹ")
local playerToolsTab, playerToolsTabStroke, playerToolsShine = makeTabButton("Player Tools", "👤")

hoverButton(actionsTab, COLORS.PANEL3, Color3.fromRGB(38, 22, 22), actionsShine)
hoverButton(infoTab, COLORS.PANEL3, Color3.fromRGB(38, 22, 22), infoShine)
hoverButton(playerToolsTab, COLORS.PANEL3, Color3.fromRGB(38, 22, 22), playerToolsShine)

local function setTabStyle(button, strokeObj, active)
	if active then
		button.BackgroundColor3 = Color3.fromRGB(46, 20, 20)
		strokeObj.Color = COLORS.RED
		strokeObj.Thickness = 1.5
	else
		button.BackgroundColor3 = COLORS.PANEL3
		strokeObj.Color = COLORS.RED3
		strokeObj.Thickness = 1.2
	end
end

local function switchTab(tabName)
	currentTab = tabName

	for name, page in pairs(pages) do
		page.Visible = (name == tabName)
	end

	setTabStyle(actionsTab, actionsTabStroke, tabName == "Actions")
	setTabStyle(infoTab, infoTabStroke, tabName == "Info")
	setTabStyle(playerToolsTab, playerToolsTabStroke, tabName == "PlayerTools")

	if tabName == "Actions" then
		contentTitle.Text = "TRY BOTH !"
		contentSub.Text = "Teleport and speed controls"
	elseif tabName == "Info" then
		contentTitle.Text = "PANEL INFO"
		contentSub.Text = "Quick notes about the current panel"
	else
		contentTitle.Text = "PLAYER TOOLS"
		contentSub.Text = "Fly, player teleport, jump power and anti ragdoll"
	end
end

--==================================================
-- ACTIONS PAGE
--==================================================
local actionsLayout = create("UIListLayout", {
	Padding = UDim.new(0, 12),
	FillDirection = Enum.FillDirection.Vertical,
	HorizontalAlignment = Enum.HorizontalAlignment.Center,
	VerticalAlignment = Enum.VerticalAlignment.Top,
	Parent = actionsPage
})

local function makeActionCard(iconText, titleText, descText, buttonText)
	local card = create("Frame", {
		BackgroundColor3 = COLORS.BG2,
		BorderSizePixel = 0,
		Size = UDim2.new(1, 0, 0, 66),
		Parent = actionsPage
	})
	makeCorner(card, UDim.new(0, 12))
	makeStroke(card, COLORS.RED3, 1.2, 0)

	local iconBox = create("Frame", {
		BackgroundColor3 = Color3.fromRGB(40, 16, 16),
		BorderSizePixel = 0,
		Position = UDim2.new(0, 10, 0.5, -18),
		Size = UDim2.new(0, 36, 0, 36),
		Parent = card
	})
	makeCorner(iconBox, UDim.new(0, 10))
	makeStroke(iconBox, COLORS.RED, 1.0, 0)

	create("TextLabel", {
		BackgroundTransparency = 1,
		Size = UDim2.fromScale(1, 1),
		Text = iconText,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 18,
		Parent = iconBox
	})

	create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 56, 0, 10),
		Size = UDim2.new(1, -166, 0, 20),
		Text = titleText,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 15,
		TextXAlignment = Enum.TextXAlignment.Left,
		Parent = card
	})

	create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 56, 0, 30),
		Size = UDim2.new(1, -166, 0, 18),
		Text = descText,
		TextColor3 = COLORS.GRAY,
		Font = Enum.Font.Gotham,
		TextSize = 12,
		TextXAlignment = Enum.TextXAlignment.Left,
		Parent = card
	})

	local actionButton = create("TextButton", {
		BackgroundColor3 = COLORS.RED2,
		BorderSizePixel = 0,
		AnchorPoint = Vector2.new(1, 0.5),
		Position = UDim2.new(1, -10, 0.5, 0),
		Size = UDim2.new(0, 92, 0, 36),
		Text = buttonText,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 13,
		AutoButtonColor = false,
		Parent = card
	})
	makeCorner(actionButton, UDim.new(0, 10))
	makeStroke(actionButton, COLORS.RED, 1.1, 0)

	local shine = create("Frame", {
		BackgroundColor3 = Color3.new(1, 1, 1),
		BackgroundTransparency = 0.95,
		BorderSizePixel = 0,
		Position = UDim2.new(0, -56, 0, 0),
		Size = UDim2.new(0, 42, 1, 0),
		Parent = actionButton
	})
	makeCorner(shine, UDim.new(0, 10))

	hoverButton(actionButton, COLORS.RED2, Color3.fromRGB(180, 28, 28), shine)

	return card, actionButton
end

local _, tpEndButton = makeActionCard("🏁", "TP EndPart", "Teleport to the nearest EndPart", "EXECUTE")
local _, tpStartButton = makeActionCard("🚩", "TP StartPart", "Teleport to the nearest StartPart", "EXECUTE")
local _, speedButton = makeActionCard("⚡", "SPEED", "Set Humanoid.WalkSpeed to 50", "EXECUTE")

--==================================================
-- PLAYER TOOLS PAGE
--==================================================
local playerToolsLayout = create("UIListLayout", {
	Padding = UDim.new(0, 12),
	FillDirection = Enum.FillDirection.Vertical,
	HorizontalAlignment = Enum.HorizontalAlignment.Center,
	VerticalAlignment = Enum.VerticalAlignment.Top,
	Parent = playerToolsPage
})

local function makePlayerToolCard(iconText, titleText, descText, height)
	local card = create("Frame", {
		BackgroundColor3 = COLORS.BG2,
		BorderSizePixel = 0,
		Size = UDim2.new(1, 0, 0, height or 78),
		Parent = playerToolsPage
	})
	makeCorner(card, UDim.new(0, 12))
	makeStroke(card, COLORS.RED3, 1.2, 0)

	local iconBox = create("Frame", {
		BackgroundColor3 = Color3.fromRGB(40, 16, 16),
		BorderSizePixel = 0,
		Position = UDim2.new(0, 10, 0, 12),
		Size = UDim2.new(0, 36, 0, 36),
		Parent = card
	})
	makeCorner(iconBox, UDim.new(0, 10))
	makeStroke(iconBox, COLORS.RED, 1.0, 0)

	create("TextLabel", {
		BackgroundTransparency = 1,
		Size = UDim2.fromScale(1, 1),
		Text = iconText,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 18,
		Parent = iconBox
	})

	create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 56, 0, 10),
		Size = UDim2.new(1, -160, 0, 20),
		Text = titleText,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 15,
		TextXAlignment = Enum.TextXAlignment.Left,
		Parent = card
	})

	create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 56, 0, 30),
		Size = UDim2.new(1, -160, 0, 18),
		Text = descText,
		TextColor3 = COLORS.GRAY,
		Font = Enum.Font.Gotham,
		TextSize = 12,
		TextXAlignment = Enum.TextXAlignment.Left,
		Parent = card
	})

	return card
end

-- Fly Card
local flyCard = makePlayerToolCard("🕊", "FLY", "Camera based fly using BodyVelocity and BodyGyro", 78)
local flyButton = create("TextButton", {
	BackgroundColor3 = COLORS.RED2,
	BorderSizePixel = 0,
	AnchorPoint = Vector2.new(1, 0.5),
	Position = UDim2.new(1, -10, 0.5, 0),
	Size = UDim2.new(0, 92, 0, 36),
	Text = "OFF",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 13,
	AutoButtonColor = false,
	Parent = flyCard
})
makeCorner(flyButton, UDim.new(0, 10))
makeStroke(flyButton, COLORS.RED, 1.1, 0)

local flyShine = create("Frame", {
	BackgroundColor3 = Color3.new(1, 1, 1),
	BackgroundTransparency = 0.95,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -56, 0, 0),
	Size = UDim2.new(0, 42, 1, 0),
	Parent = flyButton
})
makeCorner(flyShine, UDim.new(0, 10))
hoverButton(flyButton, COLORS.RED2, Color3.fromRGB(180, 28, 28), flyShine)

-- TP To Player Card
local tpPlayerCard = makePlayerToolCard("👥", "TP TO PLAYER", "Open player list with avatar thumbnails", 78)
local tpPlayerButton = create("TextButton", {
	BackgroundColor3 = COLORS.RED2,
	BorderSizePixel = 0,
	AnchorPoint = Vector2.new(1, 0.5),
	Position = UDim2.new(1, -10, 0.5, 0),
	Size = UDim2.new(0, 92, 0, 36),
	Text = "OPEN",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 13,
	AutoButtonColor = false,
	Parent = tpPlayerCard
})
makeCorner(tpPlayerButton, UDim.new(0, 10))
makeStroke(tpPlayerButton, COLORS.RED, 1.1, 0)

local tpPlayerShine = create("Frame", {
	BackgroundColor3 = Color3.new(1, 1, 1),
	BackgroundTransparency = 0.95,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -56, 0, 0),
	Size = UDim2.new(0, 42, 1, 0),
	Parent = tpPlayerButton
})
makeCorner(tpPlayerShine, UDim.new(0, 10))
hoverButton(tpPlayerButton, COLORS.RED2, Color3.fromRGB(180, 28, 28), tpPlayerShine)

-- Jump Power Card
local jumpCard = makePlayerToolCard("⬆", "JUMP POWER", "Adjust local Humanoid.JumpPower", 110)

local jumpValueLabel = create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 56, 0, 56),
	Size = UDim2.new(0, 60, 0, 20),
	Text = tostring(currentJumpPower),
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 16,
	TextXAlignment = Enum.TextXAlignment.Left,
	Parent = jumpCard
})

local function makeMiniButton(parent, text, posX, width)
	local b = create("TextButton", {
		BackgroundColor3 = COLORS.PANEL3,
		BorderSizePixel = 0,
		Position = UDim2.new(0, posX, 0, 52),
		Size = UDim2.new(0, width or 34, 0, 28),
		Text = text,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 13,
		AutoButtonColor = false,
		Parent = parent
	})
	makeCorner(b, UDim.new(0, 8))
	makeStroke(b, COLORS.RED3, 1.0, 0)
	hoverButton(b, COLORS.PANEL3, Color3.fromRGB(38, 22, 22))
	return b
end

local jumpMinus = makeMiniButton(jumpCard, "-", 110, 30)
local jumpPlus = makeMiniButton(jumpCard, "+", 146, 30)
local jump50 = makeMiniButton(jumpCard, "50", 190, 38)
local jump100 = makeMiniButton(jumpCard, "100", 234, 44)
local jump150 = makeMiniButton(jumpCard, "150", 284, 44)

-- Anti Ragdoll Card
local antiCard = makePlayerToolCard("🛡", "ANTI RAGDOLL", "Force local character back to normal state", 78)
local antiButton = create("TextButton", {
	BackgroundColor3 = COLORS.RED2,
	BorderSizePixel = 0,
	AnchorPoint = Vector2.new(1, 0.5),
	Position = UDim2.new(1, -10, 0.5, 0),
	Size = UDim2.new(0, 92, 0, 36),
	Text = "OFF",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 13,
	AutoButtonColor = false,
	Parent = antiCard
})
makeCorner(antiButton, UDim.new(0, 10))
makeStroke(antiButton, COLORS.RED, 1.1, 0)

local antiShine = create("Frame", {
	BackgroundColor3 = Color3.new(1, 1, 1),
	BackgroundTransparency = 0.95,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -56, 0, 0),
	Size = UDim2.new(0, 42, 1, 0),
	Parent = antiButton
})
makeCorner(antiShine, UDim.new(0, 10))
hoverButton(antiButton, COLORS.RED2, Color3.fromRGB(180, 28, 28), antiShine)

-- Player Picker Modal
local playerPicker = create("Frame", {
	Name = "PlayerPicker",
	BackgroundColor3 = COLORS.PANEL,
	BorderSizePixel = 0,
	AnchorPoint = Vector2.new(0.5, 0.5),
	Position = UDim2.fromScale(0.5, 0.5),
	Size = UDim2.new(0, 0, 0, 0),
	Visible = false,
	ClipsDescendants = true,
	ZIndex = 25,
	Parent = contentFrame
})
makeCorner(playerPicker, UDim.new(0, 14))
makeStroke(playerPicker, COLORS.RED, 1.4, 0)

local playerPickerGlow = create("Frame", {
	BackgroundColor3 = COLORS.RED,
	BackgroundTransparency = 0.92,
	BorderSizePixel = 0,
	Position = UDim2.new(0, -8, 0, -8),
	Size = UDim2.new(1, 16, 1, 16),
	ZIndex = 24,
	Parent = playerPicker
})
makeCorner(playerPickerGlow, UDim.new(0, 18))

local playerPickerTop = create("Frame", {
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Size = UDim2.new(1, 0, 0, 38),
	ZIndex = 26,
	Parent = playerPicker
})
makeCorner(playerPickerTop, UDim.new(0, 14))

create("Frame", {
	BackgroundColor3 = COLORS.BG2,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 0, 0, 18),
	Size = UDim2.new(1, 0, 0, 20),
	ZIndex = 26,
	Parent = playerPickerTop
})

create("TextLabel", {
	BackgroundTransparency = 1,
	Position = UDim2.new(0, 12, 0, 0),
	Size = UDim2.new(1, -50, 1, 0),
	Text = "SELECT PLAYER",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 14,
	TextXAlignment = Enum.TextXAlignment.Left,
	ZIndex = 27,
	Parent = playerPickerTop
})

local closePickerButton = create("TextButton", {
	BackgroundColor3 = COLORS.RED3,
	BorderSizePixel = 0,
	AnchorPoint = Vector2.new(1, 0.5),
	Position = UDim2.new(1, -8, 0.5, 0),
	Size = UDim2.new(0, 24, 0, 24),
	Text = "×",
	TextColor3 = COLORS.WHITE,
	Font = Enum.Font.GothamBold,
	TextSize = 16,
	AutoButtonColor = false,
	ZIndex = 27,
	Parent = playerPickerTop
})
makeCorner(closePickerButton, UDim.new(1, 0))
makeStroke(closePickerButton, COLORS.RED, 1.0, 0)
hoverButton(closePickerButton, COLORS.RED3, Color3.fromRGB(120, 22, 22))

local playerList = create("ScrollingFrame", {
	BackgroundTransparency = 1,
	BorderSizePixel = 0,
	Position = UDim2.new(0, 10, 0, 48),
	Size = UDim2.new(1, -20, 1, -58),
	CanvasSize = UDim2.new(0, 0, 0, 0),
	ScrollBarThickness = 4,
	ScrollBarImageColor3 = COLORS.RED,
	AutomaticCanvasSize = Enum.AutomaticSize.None,
	ZIndex = 27,
	Parent = playerPicker
})

local playerListLayout = create("UIListLayout", {
	Padding = UDim.new(0, 8),
	FillDirection = Enum.FillDirection.Vertical,
	HorizontalAlignment = Enum.HorizontalAlignment.Center,
	VerticalAlignment = Enum.VerticalAlignment.Top,
	Parent = playerList
})

playerListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
	playerList.CanvasSize = UDim2.new(0, 0, 0, playerListLayout.AbsoluteContentSize.Y + 6)
end)

--==================================================
-- INFO PAGE
--==================================================
local infoLayout = create("UIListLayout", {
	Padding = UDim.new(0, 12),
	FillDirection = Enum.FillDirection.Vertical,
	HorizontalAlignment = Enum.HorizontalAlignment.Center,
	VerticalAlignment = Enum.VerticalAlignment.Top,
	Parent = infoPage
})

local function makeInfoBox(titleText, descText)
	local box = create("Frame", {
		BackgroundColor3 = COLORS.BG2,
		BorderSizePixel = 0,
		Size = UDim2.new(1, 0, 0, 72),
		Parent = infoPage
	})
	makeCorner(box, UDim.new(0, 12))
	makeStroke(box, COLORS.RED3, 1.2, 0)

	create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 12, 0, 10),
		Size = UDim2.new(1, -24, 0, 20),
		Text = titleText,
		TextColor3 = COLORS.WHITE,
		Font = Enum.Font.GothamBold,
		TextSize = 14,
		TextXAlignment = Enum.TextXAlignment.Left,
		Parent = box
	})

	create("TextLabel", {
		BackgroundTransparency = 1,
		Position = UDim2.new(0, 12, 0, 30),
		Size = UDim2.new(1, -24, 0, 30),
		TextWrapped = true,
		Text = descText,
		TextColor3 = COLORS.GRAY,
		Font = Enum.Font.Gotham,
		TextSize = 12,
		TextXAlignment = Enum.TextXAlignment.Left,
		TextYAlignment = Enum.TextYAlignment.Top,
		Parent = box
	})

	return box
end

makeInfoBox("KEY", "This panel unlocks only when the correct key is entered: DULES.")
makeInfoBox("TELEPORT", "Both teleport buttons search the entire workspace and move you to the nearest matching part name.")
makeInfoBox("SPEED", "The speed button only changes your local Humanoid WalkSpeed to 50.")

--==================================================
-- FLY SYSTEM
--==================================================
local function stopFly()
	if flyConnection then
		flyConnection:Disconnect()
		flyConnection = nil
	end

	if flyBV then
		flyBV:Destroy()
		flyBV = nil
	end

	if flyBG then
		flyBG:Destroy()
		flyBG = nil
	end

	flyEnabled = false
	flyButton.Text = "OFF"
	flyButton.BackgroundColor3 = COLORS.RED2
end

local function startFly()
	local humanoid, root = getHumanoidAndRoot()
	local camera = workspace.CurrentCamera
	if not humanoid or not root or not camera then
		return
	end

	stopFly()

	flyEnabled = true

	flyBV = Instance.new("BodyVelocity")
	flyBV.Name = "X3R_FlyVelocity"
	flyBV.MaxForce = Vector3.new(1e9, 1e9, 1e9)
	flyBV.P = 15000
	flyBV.Velocity = Vector3.zero
	flyBV.Parent = root

	flyBG = Instance.new("BodyGyro")
	flyBG.Name = "X3R_FlyGyro"
	flyBG.MaxTorque = Vector3.new(1e9, 1e9, 1e9)
	flyBG.P = 15000
	flyBG.CFrame = camera.CFrame
	flyBG.Parent = root

	humanoid.PlatformStand = false
	humanoid.AutoRotate = false

	flyConnection = RunService.RenderStepped:Connect(function()
		local currentHumanoid, currentRoot = getHumanoidAndRoot()
		local currentCamera = workspace.CurrentCamera

		if not flyEnabled or not currentHumanoid or not currentRoot or not currentCamera then
			return
		end

		local moveDirection = Vector3.zero
		local look = currentCamera.CFrame.LookVector
		local right = currentCamera.CFrame.RightVector

		if flyMove.W then
			moveDirection += look
		end
		if flyMove.S then
			moveDirection -= look
		end
		if flyMove.A then
			moveDirection -= right
		end
		if flyMove.D then
			moveDirection += right
		end
		if flyMove.Up then
			moveDirection += Vector3.new(0, 1, 0)
		end
		if flyMove.Down then
			moveDirection -= Vector3.new(0, 1, 0)
		end

		if moveDirection.Magnitude > 0 then
			moveDirection = moveDirection.Unit
		end

		flyBG.CFrame = currentCamera.CFrame
		flyBV.Velocity = moveDirection * CONFIG.FLY_SPEED
		currentHumanoid.PlatformStand = false
	end)

	flyButton.Text = "ON"
	flyButton.BackgroundColor3 = Color3.fromRGB(30, 110, 50)
	setBottomStatus("Fly enabled", COLORS.SUCCESS)
end

--==================================================
-- ANTI RAGDOLL
--==================================================
local function stopAntiRagdoll()
	if antiRagdollConnection then
		antiRagdollConnection:Disconnect()
		antiRagdollConnection = nil
	end

	antiRagdollEnabled = false
	antiButton.Text = "OFF"
	antiButton.BackgroundColor3 = COLORS.RED2
end

local function startAntiRagdoll()
	stopAntiRagdoll()
	antiRagdollEnabled = true
	antiButton.Text = "ON"
	antiButton.BackgroundColor3 = Color3.fromRGB(30, 110, 50)

	antiRagdollConnection = RunService.RenderStepped:Connect(function()
		if not antiRagdollEnabled then
			return
		end

		local humanoid, root = getHumanoidAndRoot()
		if not humanoid or not root then
			return
		end

		if humanoid.PlatformStand then
			humanoid.PlatformStand = false
		end

		if humanoid.Sit then
			humanoid.Sit = false
		end

		local state = humanoid:GetState()
		if state == Enum.HumanoidStateType.Ragdoll
			or state == Enum.HumanoidStateType.FallingDown
			or state == Enum.HumanoidStateType.Physics then
			humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		end

		humanoid.AutoRotate = true
	end)

	setBottomStatus("Anti ragdoll enabled", COLORS.SUCCESS)
end

--==================================================
-- PLAYER PICKER
--==================================================
local function clearPlayerList()
	for _, child in ipairs(playerList:GetChildren()) do
		if not child:IsA("UIListLayout") then
			child:Destroy()
		end
	end
end

local function closePlayerPicker()
	local tw = tween(playerPicker, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
		Size = UDim2.new(0, 0, 0, 0)
	})
	tw.Completed:Connect(function()
		if playerPicker.Size.X.Offset == 0 then
			playerPicker.Visible = false
		end
	end)
end

local function openPlayerPicker()
	clearPlayerList()

	for _, targetPlayer in ipairs(Players:GetPlayers()) do
		if targetPlayer ~= LocalPlayer then
			local item = create("TextButton", {
				BackgroundColor3 = COLORS.BG2,
				BorderSizePixel = 0,
				Size = UDim2.new(1, -2, 0, 54),
				Text = "",
				AutoButtonColor = false,
				ZIndex = 28,
				Parent = playerList
			})
			makeCorner(item, UDim.new(0, 10))
			makeStroke(item, COLORS.RED3, 1.0, 0)

			local thumb = create("ImageLabel", {
				BackgroundColor3 = COLORS.PANEL3,
				BorderSizePixel = 0,
				Position = UDim2.new(0, 8, 0.5, -18),
				Size = UDim2.new(0, 36, 0, 36),
				Image = getThumbnail(targetPlayer.UserId),
				ZIndex = 29,
				Parent = item
			})
			makeCorner(thumb, UDim.new(1, 0))
			makeStroke(thumb, COLORS.RED, 1.0, 0)

			create("TextLabel", {
				BackgroundTransparency = 1,
				Position = UDim2.new(0, 54, 0, 9),
				Size = UDim2.new(1, -138, 0, 18),
				Text = targetPlayer.DisplayName,
				TextColor3 = COLORS.WHITE,
				Font = Enum.Font.GothamBold,
				TextSize = 14,
				TextXAlignment = Enum.TextXAlignment.Left,
				ZIndex = 29,
				Parent = item
			})

			create("TextLabel", {
				BackgroundTransparency = 1,
				Position = UDim2.new(0, 54, 0, 27),
				Size = UDim2.new(1, -138, 0, 16),
				Text = "@" .. targetPlayer.Name,
				TextColor3 = COLORS.GRAY,
				Font = Enum.Font.Gotham,
				TextSize = 11,
				TextXAlignment = Enum.TextXAlignment.Left,
				ZIndex = 29,
				Parent = item
			})

			local tpBtn = create("TextButton", {
				BackgroundColor3 = COLORS.RED2,
				BorderSizePixel = 0,
				AnchorPoint = Vector2.new(1, 0.5),
				Position = UDim2.new(1, -8, 0.5, 0),
				Size = UDim2.new(0, 68, 0, 30),
				Text = "TP",
				TextColor3 = COLORS.WHITE,
				Font = Enum.Font.GothamBold,
				TextSize = 12,
				AutoButtonColor = false,
				ZIndex = 29,
				Parent = item
			})
			makeCorner(tpBtn, UDim.new(0, 8))
			makeStroke(tpBtn, COLORS.RED, 1.0, 0)
			hoverButton(tpBtn, COLORS.RED2, Color3.fromRGB(180, 28, 28))

			tpBtn.MouseButton1Click:Connect(function()
				pulse(tpBtn)

				local myHumanoid, myRoot = getHumanoidAndRoot()
				local targetCharacter = targetPlayer.Character
				local targetRoot = targetCharacter and targetCharacter:FindFirstChild("HumanoidRootPart")

				if myHumanoid and myRoot and targetRoot then
					myRoot.CFrame = targetRoot.CFrame + Vector3.new(0, 0, -3)
					setBottomStatus("Teleported to " .. targetPlayer.Name, COLORS.SUCCESS)
					closePlayerPicker()
				else
					setBottomStatus("Target unavailable", COLORS.ERROR)
				end
			end)
		end
	end

	playerPicker.Visible = true
	playerPicker.Size = UDim2.new(0, 0, 0, 0)
	tween(playerPicker, TweenInfo.new(0.22, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
		Size = UDim2.new(0, 250, 0, 220)
	})
end

--==================================================
-- OPEN/CLOSE
--==================================================
local function openMain()
	uiOpen = true
	openButton.Visible = false
	mainFrame.Visible = true
	mainFrame.Size = CONFIG.UI_CLOSED_SIZE

	-- [EDIT 1] Blur removed: tween calls on blur dummy table do nothing
	tween(blur, TweenInfo.new(0.22, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
		Size = CONFIG.BLUR_SIZE
	})

	tween(mainFrame, TweenInfo.new(0.28, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
		Size = CONFIG.UI_SIZE
	})
end

local function closeMain()
	uiOpen = false

	-- [EDIT 1] Blur removed: tween calls on blur dummy table do nothing
	tween(blur, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
		Size = 0
	})

	local tw = tween(mainFrame, TweenInfo.new(0.20, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
		Size = CONFIG.UI_CLOSED_SIZE
	})

	tw.Completed:Connect(function()
		if not uiOpen then
			mainFrame.Visible = false
			openButton.Visible = true
			if playerPicker.Visible then
				playerPicker.Visible = false
				playerPicker.Size = UDim2.new(0, 0, 0, 0)
			end
		end
	end)
end

local function unlockPanel()
	unlocked = true

	formatStatus(keyStatus, "Access granted", COLORS.SUCCESS)
	fadeStatus(keyStatus, 0.9)

	local hide = tween(keyFrame, TweenInfo.new(0.22, Enum.EasingStyle.Back, Enum.EasingDirection.In), {
		Size = CONFIG.KEY_CLOSED_SIZE
	})

	hide.Completed:Connect(function()
		keyFrame.Visible = false
		openMain()
	end)
end

--==================================================
-- KEY CHECK
--==================================================
local function handleKeyCheck()
	pulse(confirmButton)

	local entered = tostring(keyBox.Text or ""):upper()
	if entered == CONFIG.KEY then
		unlockPanel()
	else
		formatStatus(keyStatus, "Wrong key", COLORS.ERROR)
		fadeStatus(keyStatus, 1.5)
		shake(keyFrame)
	end
end

confirmButton.MouseButton1Click:Connect(handleKeyCheck)
keyBox.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		handleKeyCheck()
	end
end)

--==================================================
-- BUTTON LOGIC
--==================================================
tpEndButton.MouseButton1Click:Connect(function()
	pulse(tpEndButton)

	local ok = teleportToNearest("EndPart")
	if ok then
		setBottomStatus("Teleported to nearest EndPart", COLORS.SUCCESS)
	else
		setBottomStatus("No EndPart found", COLORS.ERROR)
	end
end)

tpStartButton.MouseButton1Click:Connect(function()
	pulse(tpStartButton)

	local ok = teleportToNearest("StartPart")
	if ok then
		setBottomStatus("Teleported to nearest StartPart", COLORS.SUCCESS)
	else
		setBottomStatus("No StartPart found", COLORS.ERROR)
	end
end)

speedButton.MouseButton1Click:Connect(function()
	pulse(speedButton)

	local humanoid = getHumanoidAndRoot()
	if humanoid then
		humanoid.WalkSpeed = CONFIG.WALKSPEED
		currentWalkspeedBoosted = true
		setBottomStatus("WalkSpeed set to 50", COLORS.SUCCESS)
	end
end)

flyButton.MouseButton1Click:Connect(function()
	pulse(flyButton)

	if flyEnabled then
		stopFly()
		setBottomStatus("Fly disabled", COLORS.WARN)
	else
		startFly()
	end
end)

tpPlayerButton.MouseButton1Click:Connect(function()
	pulse(tpPlayerButton)
	openPlayerPicker()
	setBottomStatus("Player list opened", COLORS.LIGHT)
end)

closePickerButton.MouseButton1Click:Connect(function()
	pulse(closePickerButton)
	closePlayerPicker()
end)

jumpMinus.MouseButton1Click:Connect(function()
	pulse(jumpMinus)
	if applyJumpPower(currentJumpPower - CONFIG.JUMPPOWER_STEP) then
		jumpValueLabel.Text = tostring(currentJumpPower)
		setBottomStatus("JumpPower set to " .. currentJumpPower, COLORS.SUCCESS)
	end
end)

jumpPlus.MouseButton1Click:Connect(function()
	pulse(jumpPlus)
	if applyJumpPower(currentJumpPower + CONFIG.JUMPPOWER_STEP) then
		jumpValueLabel.Text = tostring(currentJumpPower)
		setBottomStatus("JumpPower set to " .. currentJumpPower, COLORS.SUCCESS)
	end
end)

jump50.MouseButton1Click:Connect(function()
	pulse(jump50)
	if applyJumpPower(50) then
		jumpValueLabel.Text = tostring(currentJumpPower)
		setBottomStatus("JumpPower set to 50", COLORS.SUCCESS)
	end
end)

jump100.MouseButton1Click:Connect(function()
	pulse(jump100)
	if applyJumpPower(100) then
		jumpValueLabel.Text = tostring(currentJumpPower)
		setBottomStatus("JumpPower set to 100", COLORS.SUCCESS)
	end
end)

jump150.MouseButton1Click:Connect(function()
	pulse(jump150)
	if applyJumpPower(150) then
		jumpValueLabel.Text = tostring(currentJumpPower)
		setBottomStatus("JumpPower set to 150", COLORS.SUCCESS)
	end
end)

antiButton.MouseButton1Click:Connect(function()
	pulse(antiButton)

	if antiRagdollEnabled then
		stopAntiRagdoll()
		setBottomStatus("Anti ragdoll disabled", COLORS.WARN)
	else
		startAntiRagdoll()
	end
end)

closeButton.MouseButton1Click:Connect(function()
	pulse(closeButton)
	closeMain()
end)

openButton.MouseButton1Click:Connect(function()
	pulse(openButton)
	openMain()
end)

actionsTab.MouseButton1Click:Connect(function()
	pulse(actionsTab)
	switchTab("Actions")
end)

infoTab.MouseButton1Click:Connect(function()
	pulse(infoTab)
	switchTab("Info")
end)

playerToolsTab.MouseButton1Click:Connect(function()
	pulse(playerToolsTab)
	switchTab("PlayerTools")
end)

--==================================================
-- INPUTS FOR FLY
--==================================================
UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then
		return
	end

	if input.KeyCode == Enum.KeyCode.W then
		flyMove.W = true
	elseif input.KeyCode == Enum.KeyCode.A then
		flyMove.A = true
	elseif input.KeyCode == Enum.KeyCode.S then
		flyMove.S = true
	elseif input.KeyCode == Enum.KeyCode.D then
		flyMove.D = true
	elseif input.KeyCode == Enum.KeyCode.Space then
		flyMove.Up = true
	elseif input.KeyCode == Enum.KeyCode.LeftControl then
		flyMove.Down = true
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.W then
		flyMove.W = false
	elseif input.KeyCode == Enum.KeyCode.A then
		flyMove.A = false
	elseif input.KeyCode == Enum.KeyCode.S then
		flyMove.S = false
	elseif input.KeyCode == Enum.KeyCode.D then
		flyMove.D = false
	elseif input.KeyCode == Enum.KeyCode.Space then
		flyMove.Up = false
	elseif input.KeyCode == Enum.KeyCode.LeftControl then
		flyMove.Down = false
	end
end)

--==================================================
-- GLOW ANIMATION
--==================================================
task.spawn(function()
	while gui.Parent do
		tween(mainGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.94
		})
		tween(openGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.94
		})
		tween(keyGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.93
		})
		tween(playerPickerGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.95
		})
		task.wait(1.8)

		tween(mainGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.89
		})
		tween(openGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.89
		})
		tween(keyGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.88
		})
		tween(playerPickerGlow, TweenInfo.new(1.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			BackgroundTransparency = 0.91
		})
		task.wait(1.8)
	end
end)

--==================================================
-- RESPAWN SUPPORT
--==================================================
LocalPlayer.CharacterAdded:Connect(function()
	task.wait(0.4)

	if currentWalkspeedBoosted then
		local humanoid = getHumanoidAndRoot()
		if humanoid then
			humanoid.WalkSpeed = CONFIG.WALKSPEED
		end
	end

	applyJumpPower(currentJumpPower)

	if flyEnabled then
		stopFly()
		setBottomStatus("Fly reset after respawn", COLORS.WARN)
	end
end)

--==================================================
-- INITIALIZE
--==================================================
switchTab("Actions")
keyFrame.Visible = true
mainFrame.Visible = false
openButton.Visible = false
playerPicker.Visible = false
statusBar.Text = "Ready"
statusBar.TextColor3 = COLORS.GRAY
jumpValueLabel.Text = tostring(currentJumpPower)

applyJumpPower(currentJumpPower)
popOpen(keyFrame, CONFIG.KEY_SIZE)

Features & Information

...
#slap dules

Community Comments (0)

No comments yet for this script.

More Scripts for Slap DUELS [🎉UPD!]