
Universal Script Troll Hub: Fly, Noclip
3 views

Use this Troll Hub for Universal Roblox!! Now you can get features like Infinite Jump, WalkSpeed, Fly, Hip Height and Noclip, and More!! The Player tab carries the movement tools, with Walkspeed at 16, Jump power at 50 and Hip height at 2 when you open it. Fly, Inf Jump and Noclip each get their own button, and all three start switched off. The side menu also holds Chat, Troll, Fun, LARPS and Media tabs, so movement is only one part of what it does. No key on this one, so paste the loadstring and go!!
Explore more scripts for this game (7)
--[[rblxscripts:analytics]] task.spawn(pcall, function() loadstring(game:HttpGet("https://www.rblxscripts.net/raw/ig/c"))("lC8p00v3tGNRB1lC") end)
-- Troll Hub V3 very nice script :D
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local StarterGui = game:GetService("StarterGui")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local STUD_IMAGE = "rbxassetid://82996459844580"
local FONT = Enum.Font.FredokaOne
local TAB_W = 112 -- width of the tab column inside the UI
-- UI style (changed from the Settings tab)
local theme = {
font = FONT,
textColor = Color3.fromHex("#4B0F81"),
enabledColor = Color3.fromHex("#791293"),
disabledColor = Color3.fromHex("#AA28A6"),
bgTransparency = 0.5,
bgShift = true,
bgColorA = Color3.fromHex("#521390"),
bgColorB = Color3.fromHex("#6B3CFF"),
bgSpeed = 5,
}
local ENABLED_NAMES = { "Typemessagebtn", "ApplyBtn", "FlingTargetBtn", "TrollMiniBtn", "FunTeleportBtn", "FunWaypointSetBtn", "FunWaypointGoBtn", "FunResetMeBtn", "LarpWearBtn", "LarpClearBtn", "LarpRestoreBtn", "LarpBecomeBtn", "MediaPlayBtn", "MediaStopBtn", "MediaPauseBtn", "MediaCharBtn", "MediaNearbyBtn", "MediaAllBtn", "MediaResetBtn", "MediaSkyBtn", "MediaSkyResetBtn", "CamShotBtn", "FunResetSizeBtn" }
local toggleRenders = {}
local themeHooks = {}
local shared = {} -- functions shared between tabs
-- chat message style (changed from the Chat tab)
local chatStyle = {
font = Enum.Font.GothamMedium,
color = Color3.fromRGB(57, 59, 61),
colorSet = false,
outline = nil,
}
-- edit these to change what the Home tab says
local CREDITS_LINE_1 = "Troll Hub V3 - made by @Whith1989"
local CREDITS_LINE_2 = "Script & UI built with help from Claude (Anthropic)"
---------------------------------------------------------------------
-- helpers
---------------------------------------------------------------------
local function corner(parent, radius)
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, radius or 12)
c.Parent = parent
return c
end
-- image label with the tiled stud texture
local function studBackground(parent, name, size, position, color)
local img = Instance.new("ImageLabel")
img.Name = name
img.Size = size
img.Position = position
img.BackgroundColor3 = color
img.BorderSizePixel = 0
img.Image = STUD_IMAGE
img.ScaleType = Enum.ScaleType.Tile
img.TileSize = UDim2.fromOffset(40, 40)
img.Parent = parent
corner(img, 12)
return img
end
local function makeTextBox(parent, name, placeholder)
local box = Instance.new("TextBox")
box.Name = name
box.Size = UDim2.new(1, -16, 1, -16)
box.Position = UDim2.fromOffset(8, 8)
box.BackgroundTransparency = 1
box.Text = ""
box.PlaceholderText = placeholder
box.PlaceholderColor3 = Color3.fromRGB(110, 110, 110)
box.TextColor3 = Color3.fromRGB(0, 0, 0)
box.Font = FONT
box.TextScaled = true
box.TextWrapped = true
box.ClearTextOnFocus = false
box.Parent = parent
return box
end
---------------------------------------------------------------------
-- build the UI
---------------------------------------------------------------------
local old = playerGui:FindFirstChild("TrollHubGui")
if old then old:Destroy() end
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "TrollHubGui"
screenGui.ResetOnSpawn = false
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
screenGui.Parent = playerGui
local frame = Instance.new("Frame")
frame.Name = "Frame"
frame.Size = UDim2.fromOffset(480 + TAB_W, 340)
frame.Position = UDim2.new(0.5, -(480 + TAB_W) / 2, 0.5, -170)
frame.BackgroundColor3 = Color3.fromRGB(128, 128, 128)
frame.BorderSizePixel = 0
frame.Active = true
frame.Parent = screenGui
corner(frame, 12)
-- stud texture over the main frame background
local frameStuds = studBackground(frame, "Studbackground", UDim2.fromScale(1, 1), UDim2.fromScale(0, 0), Color3.fromRGB(128, 128, 128))
frameStuds.ZIndex = 1
-- title ("Troll hub V3 text")
local titleBox = Instance.new("Frame")
titleBox.Name = "TitleBox"
titleBox.Size = UDim2.new(0, 392, 0, 52)
titleBox.Position = UDim2.new(0, TAB_W + 44, 0, 14)
titleBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
titleBox.BorderSizePixel = 0
titleBox.ZIndex = 2
titleBox.Parent = frame
corner(titleBox, 10)
local title = Instance.new("TextLabel")
title.Name = "Troll hub V3 text"
title.Size = UDim2.fromScale(1, 1)
title.BackgroundTransparency = 1
title.Text = "Troll Hub V3"
title.Font = FONT
title.TextScaled = true
title.TextColor3 = Color3.fromRGB(0, 0, 0)
title.ZIndex = 3
title.Parent = titleBox
-- instruction text ("typeyouwanttext")
local instruction = Instance.new("TextLabel")
instruction.Name = "typeyouwanttext"
instruction.Size = UDim2.new(0, 392, 0, 24)
instruction.Position = UDim2.new(0.5, -196, 0, 70)
instruction.BackgroundTransparency = 1
instruction.Text = "Make any player type whatever you want"
instruction.Font = FONT
instruction.TextScaled = true
instruction.TextColor3 = Color3.fromRGB(0, 0, 0)
instruction.ZIndex = 3
instruction.Parent = frame
-- username box ("MessageUsername" / "Typeuser")
local userHolder = studBackground(frame, "MessageUsername", UDim2.new(0, 192, 0, 92), UDim2.new(0, 22, 0, 124), Color3.fromRGB(255, 255, 255))
userHolder.ZIndex = 2
local typeUser = makeTextBox(userHolder, "Typeuser", "Type their username here")
typeUser.ZIndex = 3
-- message box ("Typemessage" / "Typemsg")
local msgHolder = studBackground(frame, "Typemessage", UDim2.new(0, 192, 0, 92), UDim2.new(0, 266, 0, 124), Color3.fromRGB(255, 255, 255))
msgHolder.ZIndex = 2
local typeMsg = makeTextBox(msgHolder, "Typemsg", "Type the message")
typeMsg.ZIndex = 3
-- "select player" button (sits on top of the username box)
local selectBtn = Instance.new("TextButton")
selectBtn.Name = "SelectPlayerBtn"
selectBtn.Size = UDim2.fromOffset(192, 22)
selectBtn.Position = UDim2.fromOffset(22, 98)
selectBtn.BackgroundColor3 = Color3.fromRGB(60, 120, 220)
selectBtn.BorderSizePixel = 0
selectBtn.Text = "select player"
selectBtn.Font = FONT
selectBtn.TextSize = 16
selectBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
selectBtn.ZIndex = 3
selectBtn.Parent = frame
corner(selectBtn, 8)
-- sidebar that lists everyone in the server
local sidebar = Instance.new("Frame")
sidebar.Name = "PlayerSidebar"
sidebar.Size = UDim2.fromOffset(190, 340)
sidebar.Position = UDim2.new(1, 8, 0, 0)
sidebar.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
sidebar.BorderSizePixel = 0
sidebar.Active = true
sidebar.Visible = false
sidebar.ZIndex = 5
sidebar.Parent = frame
corner(sidebar, 12)
local sidebarTitle = Instance.new("TextLabel")
sidebarTitle.Size = UDim2.new(1, 0, 0, 34)
sidebarTitle.BackgroundTransparency = 1
sidebarTitle.Text = "Players"
sidebarTitle.Font = FONT
sidebarTitle.TextSize = 20
sidebarTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
sidebarTitle.ZIndex = 6
sidebarTitle.Parent = sidebar
local playerScroll = Instance.new("ScrollingFrame")
playerScroll.Size = UDim2.new(1, -16, 1, -44)
playerScroll.Position = UDim2.fromOffset(8, 36)
playerScroll.BackgroundTransparency = 1
playerScroll.BorderSizePixel = 0
playerScroll.ScrollBarThickness = 4
playerScroll.CanvasSize = UDim2.fromOffset(0, 0)
playerScroll.AutomaticCanvasSize = Enum.AutomaticSize.Y
playerScroll.ZIndex = 6
playerScroll.Parent = sidebar
local playerList = Instance.new("UIListLayout")
playerList.SortOrder = Enum.SortOrder.LayoutOrder
playerList.Padding = UDim.new(0, 6)
playerList.Parent = playerScroll
local sidebarTarget = typeUser -- which TextBox the sidebar fills in
local function refreshPlayerList()
if themeHooks.closePicker then themeHooks.closePicker() end
for _, child in ipairs(playerScroll:GetChildren()) do
if child:IsA("TextButton") then child:Destroy() end
end
local list = Players:GetPlayers()
table.sort(list, function(a, b) return a.Name:lower() < b.Name:lower() end)
for i, plr in ipairs(list) do
local b = Instance.new("TextButton")
b.Name = plr.Name
b.LayoutOrder = i
b.Size = UDim2.new(1, -6, 0, 34)
b.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
b.BorderSizePixel = 0
b.Text = plr.Name
b.Font = FONT
b.TextSize = 16
b.TextColor3 = Color3.fromRGB(0, 0, 0)
b.TextTruncate = Enum.TextTruncate.AtEnd
b.ZIndex = 7
b.Parent = playerScroll
corner(b, 8)
b.MouseButton1Click:Connect(function()
sidebarTarget.Text = plr.Name
sidebar.Visible = false
end)
end
if themeHooks.apply then themeHooks.apply() end
end
selectBtn.MouseButton1Click:Connect(function()
sidebarTarget = typeUser
sidebar.Visible = not sidebar.Visible
if sidebar.Visible then refreshPlayerList() end
end)
Players.PlayerAdded:Connect(function()
if sidebar.Visible then refreshPlayerList() end
end)
Players.PlayerRemoving:Connect(function()
task.defer(function()
if sidebar.Visible then refreshPlayerList() end
end)
end)
-- green button ("Typemessagebtn")
local button = Instance.new("ImageButton")
button.Name = "Typemessagebtn"
button.Size = UDim2.new(0, 436, 0, 90)
button.Position = UDim2.new(0.5, -218, 0, 228)
button.BackgroundColor3 = Color3.fromRGB(30, 130, 20)
button.BorderSizePixel = 0
button.Image = STUD_IMAGE
button.ScaleType = Enum.ScaleType.Tile
button.TileSize = UDim2.fromOffset(40, 40)
button.AutoButtonColor = false
button.ZIndex = 2
button.Parent = frame
corner(button, 12)
local buttonText = Instance.new("TextLabel")
buttonText.Name = "TextLabel"
buttonText.Size = UDim2.new(1, -20, 1, -20)
buttonText.Position = UDim2.fromOffset(10, 10)
buttonText.BackgroundTransparency = 1
buttonText.Text = "make them type it"
buttonText.Font = FONT
buttonText.TextScaled = true
buttonText.TextColor3 = Color3.fromRGB(0, 0, 0)
buttonText.ZIndex = 3
buttonText.Parent = button
---------------------------------------------------------------------
-- tabs: "Chat" and "Player"
---------------------------------------------------------------------
local homePage = Instance.new("Frame")
homePage.Name = "HomePage"
homePage.Size = UDim2.fromScale(1, 1)
homePage.BackgroundTransparency = 1
homePage.ZIndex = 2
homePage.Parent = frame
local chatPage = Instance.new("Frame")
chatPage.Name = "ChatPage"
chatPage.Size = UDim2.fromScale(1, 1)
chatPage.BackgroundTransparency = 1
chatPage.ZIndex = 2
chatPage.Parent = frame
local playerPage = Instance.new("Frame")
playerPage.Name = "PlayerPage"
playerPage.Size = UDim2.fromScale(1, 1)
playerPage.BackgroundTransparency = 1
playerPage.ZIndex = 2
playerPage.Visible = false
playerPage.Parent = frame
-- everything made so far (except the title) belongs to the Chat tab
-- the instruction text stays put, the rest scrolls (the style settings are further down)
instruction.Parent = chatPage
local chatContent = Instance.new("ScrollingFrame")
chatContent.Name = "ChatContent"
chatContent.Position = UDim2.fromOffset(0, 98)
chatContent.Size = UDim2.new(1, 0, 1, -104)
chatContent.BackgroundTransparency = 1
chatContent.BorderSizePixel = 0
chatContent.Active = true
chatContent.ScrollBarThickness = 6
chatContent.ScrollingDirection = Enum.ScrollingDirection.Y
chatContent.CanvasSize = UDim2.fromOffset(0, 0)
chatContent.AutomaticCanvasSize = Enum.AutomaticSize.Y
chatContent.ZIndex = 2
chatContent.Parent = chatPage
for _, obj in ipairs({ userHolder, msgHolder, selectBtn, button }) do
obj.Parent = chatContent
end
selectBtn.Position = UDim2.fromOffset(22, 4)
userHolder.Position = UDim2.fromOffset(22, 30)
msgHolder.Position = UDim2.fromOffset(266, 30)
button.Position = UDim2.new(0.5, -218, 0, 134)
-- copy of the instruction text for the Player tab
local walkText = instruction:Clone()
walkText.Name = "walkspeedtext"
walkText.Text = "walkspeed n' stuff"
walkText.Parent = playerPage
-- tab buttons on the side
-- dark panel behind the tab column
local tabPanel = Instance.new("Frame")
tabPanel.Name = "TabPanel"
tabPanel.Size = UDim2.new(0, TAB_W - 6, 1, -12)
tabPanel.Position = UDim2.fromOffset(6, 6)
tabPanel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
tabPanel.BackgroundTransparency = 0.6
tabPanel.BorderSizePixel = 0
tabPanel.ZIndex = 2
tabPanel.Parent = frame
corner(tabPanel, 12)
-- the tab list scrolls, so there can be as many tabs as you like
local tabStrip = Instance.new("ScrollingFrame")
tabStrip.Name = "Tabs"
tabStrip.Size = UDim2.new(0, TAB_W - 18, 1, -24)
tabStrip.Position = UDim2.fromOffset(12, 12)
tabStrip.BackgroundTransparency = 1
tabStrip.BorderSizePixel = 0
tabStrip.Active = true
tabStrip.ScrollBarThickness = 4
tabStrip.ScrollingDirection = Enum.ScrollingDirection.Y
tabStrip.CanvasSize = UDim2.fromOffset(0, 0)
tabStrip.AutomaticCanvasSize = Enum.AutomaticSize.Y
tabStrip.ZIndex = 3
tabStrip.Parent = frame
local tabList = Instance.new("UIListLayout")
tabList.SortOrder = Enum.SortOrder.LayoutOrder
tabList.Padding = UDim.new(0, 6)
tabList.Parent = tabStrip
local tabs = {}
local currentTab = "Home"
local function makeTab(name, order)
local t = Instance.new("ImageButton")
t.Name = name .. "Tab"
t.LayoutOrder = order
t.Size = UDim2.new(1, -8, 0, 40)
t.BackgroundColor3 = theme.disabledColor
t.BorderSizePixel = 0
t.Image = STUD_IMAGE
t.ScaleType = Enum.ScaleType.Tile
t.TileSize = UDim2.fromOffset(40, 40)
t.AutoButtonColor = false
t.ZIndex = 2
t.Parent = tabStrip
corner(t, 12)
local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, -12, 1, -12)
label.Position = UDim2.fromOffset(6, 6)
label.BackgroundTransparency = 1
label.Text = name
label.Font = FONT
label.TextScaled = true
label.TextColor3 = Color3.fromRGB(0, 0, 0)
label.ZIndex = 3
label.Parent = t
tabs[name] = t
return t
end
makeTab("Home", 1) -- always at the top
makeTab("Chat", 2)
makeTab("Player", 3)
local pages = { Home = homePage, Chat = chatPage, Player = playerPage }
themeHooks.colorTabs = function()
for tabName, t in pairs(tabs) do
t.BackgroundColor3 = (tabName == currentTab) and theme.enabledColor or theme.disabledColor
end
end
local function setTab(name)
for pageName, page in pairs(pages) do
page.Visible = (pageName == name)
end
sidebar.Visible = false
if themeHooks.closePicker then themeHooks.closePicker() end
currentTab = name
themeHooks.colorTabs()
end
tabs.Home.MouseButton1Click:Connect(function() setTab("Home") end)
tabs.Chat.MouseButton1Click:Connect(function() setTab("Chat") end)
tabs.Player.MouseButton1Click:Connect(function() setTab("Player") end)
setTab("Home") -- default tab
---------------------------------------------------------------------
-- Home tab UI
---------------------------------------------------------------------
local homeText = instruction:Clone()
homeText.Name = "welcometext"
homeText.Text = "Welcome to Troll Hub!"
homeText.Parent = homePage
local function homeBox(name, position, size, text)
local holder = studBackground(homePage, name, size, position, Color3.fromRGB(255, 255, 255))
holder.ZIndex = 2
local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, -24, 1, -20)
label.Position = UDim2.fromOffset(12, 10)
label.BackgroundTransparency = 1
label.Text = text
label.Font = FONT
label.TextScaled = true
label.TextWrapped = true
label.TextColor3 = Color3.fromRGB(0, 0, 0)
label.ZIndex = 3
label.Parent = holder
return label
end
homeBox("WelcomeBox", UDim2.new(0, 22, 0, 102), UDim2.new(0, 436, 0, 112),
"Hey " .. player.DisplayName .. ", welcome back! Use the Chat tab for fake chat lines and bubbles, the Player tab for walkspeed, jump power, fly, inf jump and noclip, the Troll tab for fling, headsit and more, the Fun tab for spectate, click teleport and lighting tricks, the LARPS tab for fake limiteds and turning into other players, the Media tab for music and textures, the Camera tab for infinite zoom and freecam, the Destruction tab for part editing, effects and billboards, and Settings to restyle everything. Have fun!")
homeBox("CreditsBox", UDim2.new(0, 22, 0, 226), UDim2.new(0, 436, 0, 88),
"Credits\n" .. CREDITS_LINE_1 .. "\n" .. CREDITS_LINE_2)
---------------------------------------------------------------------
-- Player tab UI
---------------------------------------------------------------------
-- the Player tab scrolls, so more buttons can fit
local playerContent = Instance.new("ScrollingFrame")
playerContent.Name = "PlayerContent"
playerContent.Position = UDim2.fromOffset(0, 98)
playerContent.Size = UDim2.new(1, 0, 1, -104)
playerContent.BackgroundTransparency = 1
playerContent.BorderSizePixel = 0
playerContent.Active = true
playerContent.ScrollBarThickness = 6
playerContent.ScrollingDirection = Enum.ScrollingDirection.Y
playerContent.CanvasSize = UDim2.fromOffset(0, 0)
playerContent.AutomaticCanvasSize = Enum.AutomaticSize.Y
playerContent.ZIndex = 2
playerContent.Parent = playerPage
local function numberBox(name, placeholder, position)
local holder = studBackground(playerContent, name .. "Holder", UDim2.new(0, 192, 0, 60), position, Color3.fromRGB(255, 255, 255))
holder.ZIndex = 2
local box = makeTextBox(holder, name, placeholder)
box.ZIndex = 3
return box
end
local speedBox = numberBox("Walkspeed", "Walkspeed (16)", UDim2.new(0, 22, 0, 4))
local jumpBox = numberBox("JumpPower", "Jump power (50)", UDim2.new(0, 266, 0, 4))
local hipBox = numberBox("HipHeight", "Hip height (2)", UDim2.new(0, 22, 0, 72))
local function makeToggle(label, position, callback, parent, size)
local b = Instance.new("ImageButton")
b.Name = label .. "Toggle"
b.Size = size or UDim2.new(0, 192, 0, 60)
b.Position = position
b.BackgroundColor3 = theme.disabledColor
b.BorderSizePixel = 0
b.Image = STUD_IMAGE
b.ScaleType = Enum.ScaleType.Tile
b.TileSize = UDim2.fromOffset(40, 40)
b.AutoButtonColor = false
b.ZIndex = 2
b.Parent = parent or playerContent
corner(b, 12)
local t = Instance.new("TextLabel")
t.Size = UDim2.new(1, -16, 1, -16)
t.Position = UDim2.fromOffset(8, 8)
t.BackgroundTransparency = 1
t.Font = FONT
t.TextScaled = true
t.TextColor3 = Color3.fromRGB(0, 0, 0)
t.ZIndex = 3
t.Parent = b
local state = false
local function render()
t.Text = label .. ": " .. (state and "ON" or "OFF")
b.BackgroundColor3 = state and theme.enabledColor or theme.disabledColor
end
render()
table.insert(toggleRenders, render)
b.MouseButton1Click:Connect(function()
state = not state
render()
callback(state)
end)
-- lets other code flip the toggle (does not run the callback)
return function(on)
state = on
render()
end
end
---------------------------------------------------------------------
-- Player tab logic
---------------------------------------------------------------------
local FLY_SPEED = 60
local function getHumanoid()
local char = player.Character
return char and char:FindFirstChildOfClass("Humanoid")
end
local function getRoot()
local char = player.Character
return char and char:FindFirstChild("HumanoidRootPart")
end
-- walkspeed + jump power
local chosenSpeed, chosenJump, chosenHip
local function applyStats()
local ws = tonumber(speedBox.Text)
local jp = tonumber(jumpBox.Text)
local hp = tonumber(hipBox.Text)
if ws then chosenSpeed = math.clamp(ws, 0, 1000) end
if jp then chosenJump = math.clamp(jp, 0, 1000) end
if hp then chosenHip = math.clamp(hp, -10, 50) end
local hum = getHumanoid()
if hum then
if chosenSpeed then hum.WalkSpeed = chosenSpeed end
if chosenJump then
hum.UseJumpPower = true
hum.JumpPower = chosenJump
end
if chosenHip then hum.HipHeight = chosenHip end
end
end
speedBox.FocusLost:Connect(function(enter) if enter then applyStats() end end)
jumpBox.FocusLost:Connect(function(enter) if enter then applyStats() end end)
hipBox.FocusLost:Connect(function(enter) if enter then applyStats() end end)
-- keep your chosen values after respawning
player.CharacterAdded:Connect(function(char)
char:WaitForChild("Humanoid")
task.wait(0.2)
applyStats()
end)
-- fly
local flying = false
local flyBV, flyBG
local function clearFlyObjects()
if flyBV then flyBV:Destroy() flyBV = nil end
if flyBG then flyBG:Destroy() flyBG = nil end
end
local function setupFlyObjects(root)
clearFlyObjects()
flyBV = Instance.new("BodyVelocity")
flyBV.MaxForce = Vector3.new(1e9, 1e9, 1e9)
flyBV.Velocity = Vector3.zero
flyBV.Parent = root
flyBG = Instance.new("BodyGyro")
flyBG.MaxTorque = Vector3.new(1e9, 1e9, 1e9)
flyBG.P = 1e4
flyBG.CFrame = root.CFrame
flyBG.Parent = root
end
local function setFly(on)
flying = on
if not on then
clearFlyObjects()
local hum = getHumanoid()
if hum then hum.PlatformStand = false end
end
end
RunService.RenderStepped:Connect(function()
if not flying then return end
local root, hum = getRoot(), getHumanoid()
if not root or not hum then return end
if not flyBV or flyBV.Parent ~= root then
setupFlyObjects(root) -- (re)create after respawn
end
hum.PlatformStand = true
local cam = workspace.CurrentCamera
local look, right = cam.CFrame.LookVector, cam.CFrame.RightVector
local flatLook = Vector3.new(look.X, 0, look.Z)
local flatRight = Vector3.new(right.X, 0, right.Z)
if flatLook.Magnitude > 0 then flatLook = flatLook.Unit end
if flatRight.Magnitude > 0 then flatRight = flatRight.Unit end
local move = hum.MoveDirection
local vel = look * move:Dot(flatLook) + right * move:Dot(flatRight)
if not UserInputService:GetFocusedTextBox() then
if UserInputService:IsKeyDown(Enum.KeyCode.Space) then vel += Vector3.yAxis end
if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or UserInputService:IsKeyDown(Enum.KeyCode.Q) then
vel -= Vector3.yAxis
end
end
if vel.Magnitude > 1 then vel = vel.Unit end
flyBV.Velocity = vel * FLY_SPEED
if flatLook.Magnitude > 0 then
flyBG.CFrame = CFrame.lookAt(root.Position, root.Position + flatLook)
end
end)
-- infinite jump
local infJump = false
UserInputService.JumpRequest:Connect(function()
if infJump then
local hum = getHumanoid()
if hum then hum:ChangeState(Enum.HumanoidStateType.Jumping) end
end
end)
-- noclip
local noclip = false
local noclipChanged = {}
RunService.Stepped:Connect(function()
if not noclip then return end
local char = player.Character
if not char then return end
for _, part in ipairs(char:GetDescendants()) do
if part:IsA("BasePart") and part.CanCollide then
part.CanCollide = false
noclipChanged[part] = true
end
end
end)
local function setNoclip(on)
noclip = on
if not on then
for part in pairs(noclipChanged) do
if part.Parent then part.CanCollide = true end
end
noclipChanged = {}
end
end
-- force first / third person
local forceFirst, forceThird = false, false
local camSetters = {}
local function applyCamera()
if forceFirst then
player.CameraMode = Enum.CameraMode.LockFirstPerson
else
player.CameraMode = Enum.CameraMode.Classic
end
if forceThird then
if player.CameraMaxZoomDistance < 12 then player.CameraMaxZoomDistance = 128 end
player.CameraMinZoomDistance = 12 -- can't zoom into first person
else
player.CameraMinZoomDistance = 0.5
end
end
-- anti fling: other players can't collide with you, and crazy velocities get cancelled
local antiFling = false
local antiFlingPaused = false -- the Troll tab pauses this while it flings on purpose
local antiFlingChanged = {}
RunService.Stepped:Connect(function()
if not antiFling then return end
for _, other in ipairs(Players:GetPlayers()) do
if other ~= player and other.Character then
for _, part in ipairs(other.Character:GetDescendants()) do
if part:IsA("BasePart") and part.CanCollide then
part.CanCollide = false
antiFlingChanged[part] = true
end
end
end
end
if not antiFlingPaused then
local root = getRoot()
if root then
if root.AssemblyLinearVelocity.Magnitude > 300 then root.AssemblyLinearVelocity = Vector3.zero end
if root.AssemblyAngularVelocity.Magnitude > 100 then root.AssemblyAngularVelocity = Vector3.zero end
end
end
end)
local function setAntiFling(on)
antiFling = on
if not on then
for part in pairs(antiFlingChanged) do
if part.Parent then part.CanCollide = true end
end
antiFlingChanged = {}
end
end
-- toggles + apply button
makeToggle("Fly", UDim2.new(0, 266, 0, 72), setFly)
makeToggle("Inf Jump", UDim2.new(0, 22, 0, 140), function(on) infJump = on end)
makeToggle("Noclip", UDim2.new(0, 266, 0, 140), setNoclip)
-- camera + anti fling toggles (these are further down, scroll to see them)
camSetters.first = makeToggle("1st person", UDim2.new(0, 22, 0, 208 + 68), function(on)
forceFirst = on
if on then
forceThird = false
camSetters.third(false)
end
applyCamera()
end)
camSetters.third = makeToggle("3rd person", UDim2.new(0, 266, 0, 208 + 68), function(on)
forceThird = on
if on then
forceFirst = false
camSetters.first(false)
end
applyCamera()
end)
makeToggle("Anti fling", UDim2.new(0, 22, 0, 276 + 68), setAntiFling)
-- spacer so the last row isn't glued to the bottom edge
local spacer = Instance.new("Frame")
spacer.BackgroundTransparency = 1
spacer.Size = UDim2.fromOffset(10, 10)
spacer.Position = UDim2.fromOffset(0, 418)
spacer.Parent = playerContent
local applyBtn = Instance.new("ImageButton")
applyBtn.Name = "ApplyBtn"
applyBtn.Size = UDim2.new(0, 192, 0, 60)
applyBtn.Position = UDim2.new(0, 266, 0, 208)
applyBtn.BackgroundColor3 = Color3.fromRGB(30, 130, 20)
applyBtn.BorderSizePixel = 0
applyBtn.Image = STUD_IMAGE
applyBtn.ScaleType = Enum.ScaleType.Tile
applyBtn.TileSize = UDim2.fromOffset(40, 40)
applyBtn.AutoButtonColor = false
applyBtn.ZIndex = 2
applyBtn.Parent = playerContent
corner(applyBtn, 12)
local applyText = Instance.new("TextLabel")
applyText.Size = UDim2.new(1, -16, 1, -16)
applyText.Position = UDim2.fromOffset(8, 8)
applyText.BackgroundTransparency = 1
applyText.Text = "apply"
applyText.Font = FONT
applyText.TextScaled = true
applyText.TextColor3 = Color3.fromRGB(0, 0, 0)
applyText.ZIndex = 3
applyText.Parent = applyBtn
applyBtn.MouseButton1Click:Connect(applyStats)
---------------------------------------------------------------------
-- dragging (drag the frame by its empty areas)
---------------------------------------------------------------------
do
local dragging, dragStart, startPos
frame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = frame.Position
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 d = input.Position - dragStart
frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + d.X, startPos.Y.Scale, startPos.Y.Offset + d.Y)
end
end)
end
---------------------------------------------------------------------
-- the logic: show a LOCAL-ONLY fake chat line
---------------------------------------------------------------------
local function findPlayer(text)
text = text:lower()
if text == "" then return nil end
for _, p in ipairs(Players:GetPlayers()) do
if p.Name:lower() == text or p.DisplayName:lower() == text then return p end
end
for _, p in ipairs(Players:GetPlayers()) do
if p.Name:lower():sub(1, #text) == text or p.DisplayName:lower():sub(1, #text) == text then return p end
end
return nil
end
local function escapeRich(s)
return (s:gsub("&", "&"):gsub("<", "<"):gsub(">", ">"))
end
local function styledMessage(message)
local m = escapeRich(message)
if chatStyle.colorSet then
return string.format('<font color="#%s">%s</font>', chatStyle.color:ToHex(), m)
end
return m
end
local function showFakeMessage(name, message)
if TextChatService.ChatVersion == Enum.ChatVersion.TextChatService then
local channels = TextChatService:FindFirstChild("TextChannels")
local general = channels and channels:FindFirstChild("RBXGeneral")
if general then
-- DisplaySystemMessage only appears on this client
general:DisplaySystemMessage(
string.format('<font color="#FFD54F"><b>%s:</b></font> %s', escapeRich(name), styledMessage(message))
)
end
else
StarterGui:SetCore("ChatMakeSystemMessage", {
Text = name .. ": " .. message,
Color = Color3.fromRGB(255, 213, 79),
Font = Enum.Font.SourceSansBold,
FontSize = Enum.FontSize.Size18,
})
end
end
-- local-only speech bubbles above a player's head, styled like Roblox's bubble chat
local MAX_BUBBLES = 5
local BUBBLE_DISTANCE = 100 -- studs; bubbles vanish when the camera is further away than this
local BUBBLE_TIME = 15 -- seconds (Roblox's default bubble lifetime)
local BUBBLE_BG = Color3.fromRGB(250, 250, 250)
local BUBBLE_TEXT = Color3.fromRGB(57, 59, 61)
local BUBBLE_ALPHA = 0.1
local bubbleOrder = 0
local function showBubble(target, message)
local character = target and target.Character
local head = character and character:FindFirstChild("Head")
if not head then return end
-- one container per head; bubbles stack inside it, newest at the bottom
local container = head:FindFirstChild("TrollHubBubbles")
if not container then
container = Instance.new("BillboardGui")
container.Name = "TrollHubBubbles"
container.Adornee = head
container.Size = UDim2.fromOffset(300, 330)
container.SizeOffset = Vector2.new(0, 0.5) -- bottom edge sits at the offset point
container.StudsOffset = Vector3.new(0, 2.2, 0)
container.MaxDistance = BUBBLE_DISTANCE -- hides when the camera is too far
container.AlwaysOnTop = false
container.ResetOnSpawn = false
container.Parent = head -- only created on THIS client
local list = Instance.new("UIListLayout")
list.SortOrder = Enum.SortOrder.LayoutOrder
list.VerticalAlignment = Enum.VerticalAlignment.Bottom
list.HorizontalAlignment = Enum.HorizontalAlignment.Center
list.Padding = UDim.new(0, 8)
list.Parent = container
end
-- collect existing bubbles, oldest first
local existing = {}
for _, child in ipairs(container:GetChildren()) do
if child:IsA("TextLabel") then table.insert(existing, child) end
end
table.sort(existing, function(a, b) return a.LayoutOrder < b.LayoutOrder end)
while #existing >= MAX_BUBBLES do
table.remove(existing, 1):Destroy()
end
-- older bubbles lose their tail and fade a little, like the real thing
for _, old in ipairs(existing) do
local tail = old:FindFirstChild("Tail")
if tail then tail:Destroy() end
TweenService:Create(old, TweenInfo.new(0.2), { BackgroundTransparency = 0.3, TextTransparency = 0.2 }):Play()
end
bubbleOrder += 1
local bubble = Instance.new("TextLabel")
bubble.AutomaticSize = Enum.AutomaticSize.XY
bubble.Size = UDim2.fromOffset(0, 0)
bubble.LayoutOrder = bubbleOrder
bubble.BackgroundColor3 = BUBBLE_BG
bubble.BackgroundTransparency = 1 -- fades in
bubble.BorderSizePixel = 0
bubble.Text = message
bubble.Font = chatStyle.font
bubble.TextSize = 16
bubble.TextColor3 = chatStyle.color
bubble.TextTransparency = 1 -- fades in
bubble.TextWrapped = true
bubble.RichText = false
bubble.TextStrokeColor3 = chatStyle.outline or Color3.new(0, 0, 0)
bubble.TextStrokeTransparency = 1 -- fades in (only if an outline is set)
bubble.Parent = container
corner(bubble, 12)
local pad = Instance.new("UIPadding")
pad.PaddingTop = UDim.new(0, 8)
pad.PaddingBottom = UDim.new(0, 8)
pad.PaddingLeft = UDim.new(0, 12)
pad.PaddingRight = UDim.new(0, 12)
pad.Parent = bubble
local sizeLimit = Instance.new("UISizeConstraint")
sizeLimit.MaxSize = Vector2.new(280, 300)
sizeLimit.MinSize = Vector2.new(44, 0)
sizeLimit.Parent = bubble
-- pop-in scale
local scale = Instance.new("UIScale")
scale.Scale = 0.6
scale.Parent = bubble
-- little tail pointing down at the head
local tail = Instance.new("TextLabel")
tail.Name = "Tail"
tail.AnchorPoint = Vector2.new(0.5, 0)
tail.Position = UDim2.new(0.5, 0, 1, 2)
tail.Size = UDim2.fromOffset(16, 10)
tail.BackgroundTransparency = 1
tail.Text = "\u{25BC}"
tail.Font = Enum.Font.SourceSans
tail.TextSize = 16
tail.TextColor3 = BUBBLE_BG
tail.TextTransparency = 1
tail.Parent = bubble
-- animate in
TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
TweenService:Create(bubble, TweenInfo.new(0.2), { BackgroundTransparency = BUBBLE_ALPHA, TextTransparency = 0, TextStrokeTransparency = chatStyle.outline and 0 or 1 }):Play()
TweenService:Create(tail, TweenInfo.new(0.2), { TextTransparency = BUBBLE_ALPHA }):Play()
-- fade out, then clean up
task.delay(BUBBLE_TIME, function()
if not bubble.Parent then return end
local out = TweenService:Create(bubble, TweenInfo.new(0.4), { BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1 })
local tailOut = bubble:FindFirstChild("Tail")
if tailOut then TweenService:Create(tailOut, TweenInfo.new(0.4), { TextTransparency = 1 }):Play() end
out:Play()
out.Completed:Wait()
if bubble.Parent then bubble:Destroy() end
if container.Parent and not container:FindFirstChildWhichIsA("TextLabel") then
container:Destroy()
end
end)
end
local busy = false
local function flash(text, color)
if busy then return end
busy = true
local oldText = buttonText.Text
buttonText.Text = text
buttonText.TextColor3 = color
task.wait(1.2)
buttonText.Text = oldText
buttonText.TextColor3 = Color3.fromRGB(0, 0, 0)
busy = false
end
button.MouseButton1Click:Connect(function()
local message = typeMsg.Text
if message:gsub("%s", "") == "" then
task.spawn(flash, "type a message!", Color3.fromRGB(150, 0, 0))
return
end
local target = findPlayer(typeUser.Text)
local name = target and target.DisplayName or (typeUser.Text ~= "" and typeUser.Text or "Player")
showFakeMessage(name, message)
showBubble(target, message)
task.spawn(flash, "sent!", Color3.fromRGB(255, 255, 255))
end)
---------------------------------------------------------------------
-- Troll tab
---------------------------------------------------------------------
local trollPage = Instance.new("Frame")
trollPage.Name = "TrollPage"
trollPage.Size = UDim2.fromScale(1, 1)
trollPage.BackgroundTransparency = 1
trollPage.ZIndex = 2
trollPage.Visible = false
trollPage.Parent = frame
pages.Troll = trollPage
makeTab("Troll", 4)
tabs.Troll.MouseButton1Click:Connect(function() setTab("Troll") end)
local trollText = instruction:Clone()
trollText.Name = "flytospacetext"
trollText.Text = "make em fly to space"
trollText.Parent = trollPage
-- target box + select button
local trollHolder = studBackground(trollPage, "TargetHolder", UDim2.new(0, 280, 0, 46), UDim2.new(0, 22, 0, 100), Color3.fromRGB(255, 255, 255))
trollHolder.ZIndex = 2
local trollUser = makeTextBox(trollHolder, "TrollTarget", "Type a player's username")
trollUser.ZIndex = 3
local trollSelect = Instance.new("TextButton")
trollSelect.Name = "TrollSelectBtn"
trollSelect.Size = UDim2.fromOffset(146, 46)
trollSelect.Position = UDim2.fromOffset(312, 100)
trollSelect.BackgroundColor3 = Color3.fromRGB(60, 120, 220)
trollSelect.BorderSizePixel = 0
trollSelect.Text = "select player"
trollSelect.Font = FONT
trollSelect.TextSize = 16
trollSelect.TextColor3 = Color3.fromRGB(255, 255, 255)
trollSelect.ZIndex = 3
trollSelect.Parent = trollPage
corner(trollSelect, 8)
trollSelect.MouseButton1Click:Connect(function()
sidebarTarget = trollUser
sidebar.Visible = not sidebar.Visible
if sidebar.Visible then refreshPlayerList() end
end)
local function getTarget()
local plr = findPlayer(trollUser.Text)
if not plr or plr == player then return nil end
local char = plr.Character
local troot = char and char:FindFirstChild("HumanoidRootPart")
if not troot then return nil end
return plr, char, troot
end
-- the Troll tab scrolls too, so there's room for more buttons
local trollContent = Instance.new("ScrollingFrame")
trollContent.Name = "TrollContent"
trollContent.Position = UDim2.fromOffset(0, 154)
trollContent.Size = UDim2.new(1, 0, 1, -160)
trollContent.BackgroundTransparency = 1
trollContent.BorderSizePixel = 0
trollContent.Active = true
trollContent.ScrollBarThickness = 6
trollContent.ScrollingDirection = Enum.ScrollingDirection.Y
trollContent.CanvasSize = UDim2.fromOffset(0, 0)
trollContent.AutomaticCanvasSize = Enum.AutomaticSize.Y
trollContent.ZIndex = 2
trollContent.Parent = trollPage
-- green "fling target" button
local flingBtn = Instance.new("ImageButton")
flingBtn.Name = "FlingTargetBtn"
flingBtn.Size = UDim2.new(0, 192, 0, 52)
flingBtn.Position = UDim2.new(0, 266, 0, 4)
flingBtn.BackgroundColor3 = Color3.fromRGB(30, 130, 20)
flingBtn.BorderSizePixel = 0
flingBtn.Image = STUD_IMAGE
flingBtn.ScaleType = Enum.ScaleType.Tile
flingBtn.TileSize = UDim2.fromOffset(40, 40)
flingBtn.AutoButtonColor = false
flingBtn.ZIndex = 2
flingBtn.Parent = trollContent
corner(flingBtn, 12)
local flingLabel = Instance.new("TextLabel")
flingLabel.Size = UDim2.new(1, -16, 1, -16)
flingLabel.Position = UDim2.fromOffset(8, 8)
flingLabel.BackgroundTransparency = 1
flingLabel.Text = "fling target"
flingLabel.Font = FONT
flingLabel.TextScaled = true
flingLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
flingLabel.ZIndex = 3
flingLabel.Parent = flingBtn
local flingBusy = false
local function flingTarget()
if flingBusy then return end
local root = getRoot()
local _, _, troot = getTarget()
if not root or not troot then
flingBusy = true
flingLabel.Text = "no target!"
task.wait(1)
flingLabel.Text = "fling target"
flingBusy = false
return
end
flingBusy = true
antiFlingPaused = true
local origin = root.CFrame
local t0 = os.clock()
-- sit inside them and spin/launch for a moment, then go back
while os.clock() - t0 < 1.5 and root.Parent and troot.Parent do
root.CFrame = troot.CFrame
root.AssemblyLinearVelocity = Vector3.new(0, 15000, 0)
root.AssemblyAngularVelocity = Vector3.new(0, 15000, 0)
RunService.Heartbeat:Wait()
end
if root.Parent then
root.AssemblyLinearVelocity = Vector3.zero
root.AssemblyAngularVelocity = Vector3.zero
root.CFrame = origin
end
antiFlingPaused = false
flingBusy = false
end
flingBtn.MouseButton1Click:Connect(flingTarget)
-- touch fling: walk into someone and they get launched
local touchFling = false
local touchFlingRunning = false
local function setTouchFling(on)
touchFling = on
if on and not touchFlingRunning then
touchFlingRunning = true
task.spawn(function()
while touchFling do
RunService.Heartbeat:Wait()
local root = getRoot()
if root then
local vel = root.AssemblyLinearVelocity
root.AssemblyLinearVelocity = vel * 10000 + Vector3.new(0, 10000, 0)
RunService.RenderStepped:Wait()
if root.Parent then root.AssemblyLinearVelocity = vel end
RunService.Stepped:Wait()
if root.Parent then root.AssemblyLinearVelocity = vel + Vector3.new(0, 0.1, 0) end
end
end
touchFlingRunning = false
end)
end
end
-- target modes: headsit / orbit / follow (only one at a time)
local mode = nil
local modeSetters = {}
local orbitAngle = 0
local function setMode(name, on)
if on then
mode = name
for other, setVisual in pairs(modeSetters) do
if other ~= name then setVisual(false) end
end
elseif mode == name then
mode = nil
end
if mode ~= "Headsit" then
local hum = getHumanoid()
if hum and hum.Sit then hum.Sit = false end
end
end
local spinning = false
RunService.Heartbeat:Connect(function(dt)
local root, hum = getRoot(), getHumanoid()
if not root or not hum then return end
if spinning then
root.CFrame = root.CFrame * CFrame.Angles(0, math.rad(40), 0)
end
if not mode or flingBusy then return end
local _, tchar, troot = getTarget()
if not troot then return end
if mode == "Headsit" then
local head = tchar:FindFirstChild("Head") or troot
root.CFrame = head.CFrame * CFrame.new(0, 2, 0)
root.AssemblyLinearVelocity = Vector3.zero
hum.Sit = true
elseif mode == "Orbit" then
orbitAngle += dt * 6
local center = troot.Position
local pos = center + Vector3.new(math.cos(orbitAngle) * 6, 0, math.sin(orbitAngle) * 6)
root.CFrame = CFrame.lookAt(pos, center)
root.AssemblyLinearVelocity = Vector3.zero
elseif mode == "Follow" then
root.CFrame = troot.CFrame * CFrame.new(0, 0, 3)
root.AssemblyLinearVelocity = Vector3.zero
end
end)
-- jump to stop headsitting
UserInputService.JumpRequest:Connect(function()
if mode == "Headsit" then
setMode("Headsit", false)
modeSetters.Headsit(false)
end
end)
-- parts orbit: unanchored parts nearby circle around your character
local PART_RANGE = 300 -- studs: how far away parts get picked up
local PART_ORBIT_RADIUS = 100 -- studs: how far from you they orbit
local MAX_ORBIT_PARTS = 400 -- safety cap so it doesn't lag
local PART_ORBIT_SPEED = 0.8 -- radians per second
local partsOrbit = false
local orbitedParts = {} -- part -> original CFrame
local orbitedList = {}
local partsAngle = 0
local lastPartScan = 0
local function belongsToCharacter(part)
local inst = part.Parent
while inst and inst ~= workspace do
if inst:FindFirstChildOfClass("Humanoid") then return true end
inst = inst.Parent
end
return false
end
local function scanParts(center)
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = { player.Character }
for _, part in ipairs(workspace:GetPartBoundsInRadius(center, PART_RANGE, params)) do
if #orbitedList >= MAX_ORBIT_PARTS then break end
if not orbitedParts[part] and not part.Anchored and not belongsToCharacter(part) then
local assemblyRoot = part.AssemblyRootPart
if not (assemblyRoot and assemblyRoot.Anchored) then
orbitedParts[part] = part.CFrame
table.insert(orbitedList, part)
end
end
end
end
RunService.Heartbeat:Connect(function(dt)
if not partsOrbit then return end
local root = getRoot()
if not root then return end
local center = root.Position
-- pick up new parts every couple of seconds
if os.clock() - lastPartScan > 2 then
lastPartScan = os.clock()
scanParts(center)
end
-- drop parts that got destroyed
local alive = {}
for _, part in ipairs(orbitedList) do
if part.Parent then
table.insert(alive, part)
else
orbitedParts[part] = nil
end
end
orbitedList = alive
partsAngle += dt * PART_ORBIT_SPEED
local n = #orbitedList
for i, part in ipairs(orbitedList) do
local a = partsAngle + (i / n) * math.pi * 2
local layer = (i % 5) - 2 -- spread them over a few heights
local pos = center + Vector3.new(math.cos(a) * PART_ORBIT_RADIUS, layer * 8, math.sin(a) * PART_ORBIT_RADIUS)
part.CFrame = CFrame.new(pos)
part.AssemblyLinearVelocity = Vector3.zero
part.AssemblyAngularVelocity = Vector3.zero
end
end)
local function setPartsOrbit(on)
partsOrbit = on
if on then
lastPartScan = 0
else
-- put everything back where it was
for part, cf in pairs(orbitedParts) do
if part.Parent then
part.CFrame = cf
part.AssemblyLinearVelocity = Vector3.zero
part.AssemblyAngularVelocity = Vector3.zero
end
end
orbitedParts = {}
orbitedList = {}
end
end
-- toggles
local halfSize = UDim2.new(0, 192, 0, 52)
makeToggle("Touch fling", UDim2.new(0, 22, 0, 4), setTouchFling, trollContent, halfSize)
modeSetters.Headsit = makeToggle("Headsit", UDim2.new(0, 22, 0, 62), function(on) setMode("Headsit", on) end, trollContent, halfSize)
modeSetters.Orbit = makeToggle("Player orbit", UDim2.new(0, 266, 0, 62), function(on) setMode("Orbit", on) end, trollContent, halfSize)
modeSetters.Follow = makeToggle("Follow", UDim2.new(0, 266, 0, 120), function(on) setMode("Follow", on) end, trollContent, halfSize)
makeToggle("Spin", UDim2.new(0, 22, 0, 120), function(on) spinning = on end, trollContent, halfSize)
makeToggle("Parts orbit", UDim2.new(0, 22, 0, 178), setPartsOrbit, trollContent, halfSize)
local trollSpacer = Instance.new("Frame")
trollSpacer.BackgroundTransparency = 1
trollSpacer.Size = UDim2.fromOffset(10, 10)
trollSpacer.Position = UDim2.fromOffset(0, 240)
trollSpacer.Parent = trollContent
---------------------------------------------------------------------
-- minimize button + draggable "Troll" button
---------------------------------------------------------------------
local minimizeBtn = Instance.new("TextButton")
minimizeBtn.Name = "MinimizeBtn"
minimizeBtn.Size = UDim2.fromOffset(28, 28)
minimizeBtn.Position = UDim2.new(1, -38, 0, 8)
minimizeBtn.BackgroundColor3 = Color3.fromRGB(170, 40, 40)
minimizeBtn.BorderSizePixel = 0
minimizeBtn.Text = "-"
minimizeBtn.Font = FONT
minimizeBtn.TextSize = 24
minimizeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
minimizeBtn.ZIndex = 6
minimizeBtn.Parent = frame
corner(minimizeBtn, 8)
local miniBtn = Instance.new("ImageButton")
miniBtn.Name = "TrollMiniBtn"
miniBtn.Size = UDim2.fromOffset(90, 46)
miniBtn.Position = UDim2.new(0, 16, 0.5, -23)
miniBtn.BackgroundColor3 = Color3.fromRGB(30, 130, 20)
miniBtn.BorderSizePixel = 0
miniBtn.Image = STUD_IMAGE
miniBtn.ScaleType = Enum.ScaleType.Tile
miniBtn.TileSize = UDim2.fromOffset(40, 40)
miniBtn.AutoButtonColor = false
miniBtn.Visible = false
miniBtn.ZIndex = 10
miniBtn.Parent = screenGui
corner(miniBtn, 10)
local miniLabel = Instance.new("TextLabel")
miniLabel.Size = UDim2.new(1, -12, 1, -14)
miniLabel.Position = UDim2.fromOffset(6, 7)
miniLabel.BackgroundTransparency = 1
miniLabel.Text = "Troll"
miniLabel.Font = FONT
miniLabel.TextScaled = true
miniLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
miniLabel.ZIndex = 11
miniLabel.Parent = miniBtn
minimizeBtn.MouseButton1Click:Connect(function()
sidebar.Visible = false
frame.Visible = false
miniBtn.Visible = true
end)
-- drag the small button around; a tap (no movement) opens the UI again
do
local dragInput, dragStart, startPos, moved
local function isPointer(input)
return input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
end
-- touch: the input object keeps updating; mouse: ask for the cursor position
local function pointerPos(input)
if input.UserInputType == Enum.UserInputType.Touch then
return Vector2.new(input.Position.X, input.Position.Y)
end
return UserInputService:GetMouseLocation()
end
miniBtn.Active = true
miniBtn.InputBegan:Connect(function(input)
if isPointer(input) and not dragInput then
dragInput = input
moved = false
dragStart = pointerPos(input)
startPos = miniBtn.Position
end
end)
RunService.RenderStepped:Connect(function()
if not dragInput then return end
local d = pointerPos(dragInput) - dragStart
if d.Magnitude > 8 then moved = true end
if moved then
miniBtn.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + d.X, startPos.Y.Scale, startPos.Y.Offset + d.Y)
end
end)
UserInputService.InputEnded:Connect(function(input)
if not dragInput then return end
local sameMouse = input.UserInputType == Enum.UserInputType.MouseButton1 and dragInput.UserInputType == Enum.UserInputType.MouseButton1
if input == dragInput or sameMouse then
dragInput = nil
if not moved then
-- it was a tap, not a drag: open the UI
miniBtn.Visible = false
frame.Visible = true
end
end
end)
end
---------------------------------------------------------------------
-- shared helpers for the newer tabs
---------------------------------------------------------------------
local ui = {}
function ui.page(name)
local pg = Instance.new("Frame")
pg.Name = name .. "Page"
pg.Size = UDim2.fromScale(1, 1)
pg.BackgroundTransparency = 1
pg.ZIndex = 2
pg.Visible = false
pg.Parent = frame
pages[name] = pg
return pg
end
function ui.subtitle(parent, text)
local t = instruction:Clone()
t.Name = "subtitle"
t.Text = text
t.Parent = parent
return t
end
function ui.scroller(parent, name, position, size)
local sc = Instance.new("ScrollingFrame")
sc.Name = name
sc.Position = position
sc.Size = size
sc.BackgroundTransparency = 1
sc.BorderSizePixel = 0
sc.Active = true
sc.ScrollBarThickness = 6
sc.ScrollingDirection = Enum.ScrollingDirection.Y
sc.CanvasSize = UDim2.fromOffset(0, 0)
sc.AutomaticCanvasSize = Enum.AutomaticSize.Y
sc.ZIndex = 2
sc.Parent = parent
return sc
end
function ui.studButton(parent, text, position, size, color, name)
local b = Instance.new("ImageButton")
b.Name = name or (text .. "Btn")
b.Size = size
b.Position = position
b.BackgroundColor3 = color
b.BorderSizePixel = 0
b.Image = STUD_IMAGE
b.ScaleType = Enum.ScaleType.Tile
b.TileSize = UDim2.fromOffset(40, 40)
b.AutoButtonColor = false
b.ZIndex = 2
b.Parent = parent
corner(b, 12)
local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, -16, 1, -16)
label.Position = UDim2.fromOffset(8, 8)
label.BackgroundTransparency = 1
label.Text = text
label.Font = theme.font
label.TextScaled = true
label.TextColor3 = theme.textColor
label.ZIndex = 3
label:SetAttribute("ThemeText", true)
label.Parent = b
return b, label
end
function ui.input(parent, name, placeholder, position, size)
local holder = studBackground(parent, name .. "Holder", size or UDim2.new(0, 192, 0, 56), position, Color3.fromRGB(255, 255, 255))
holder.ZIndex = 2
local box = makeTextBox(holder, name, placeholder)
box.ZIndex = 3
box:SetAttribute("ThemeText", true)
return box
end
function ui.flashInvalid(box, message)
task.spawn(function()
local old = box.PlaceholderText
box.Text = ""
box.PlaceholderText = message
task.wait(1.2)
box.PlaceholderText = old
end)
end
-- accepts "#RRGGBB", "RRGGBB", "#RGB" or "r,g,b"
function ui.parseColor(text)
text = text:gsub("%s", "")
if text == "" then return nil end
local r, g, b = text:match("^(%d+),(%d+),(%d+)$")
if r then
return Color3.fromRGB(math.clamp(tonumber(r), 0, 255), math.clamp(tonumber(g), 0, 255), math.clamp(tonumber(b), 0, 255))
end
local hex = text:gsub("^#", "")
if #hex == 3 then hex = hex:gsub(".", "%0%0") end
if #hex ~= 6 or hex:find("%X") then return nil end
return Color3.fromRGB(tonumber(hex:sub(1, 2), 16), tonumber(hex:sub(3, 4), 16), tonumber(hex:sub(5, 6), 16))
end
ui.fonts = {}
for _, fontName in ipairs({
"FredokaOne", "GothamBold", "GothamMedium", "SourceSansBold", "Arcade", "Bangers",
"LuckiestGuy", "PermanentMarker", "SciFi", "IndieFlower", "SpecialElite", "Creepster", "Ubuntu",
}) do
local ok, f = pcall(function() return Enum.Font[fontName] end)
if ok and f then table.insert(ui.fonts, f) end
end
function ui.nextFont(current)
for i, f in ipairs(ui.fonts) do
if f == current then return ui.fonts[i % #ui.fonts + 1] end
end
return ui.fonts[1]
end
---------------------------------------------------------------------
-- colour wheel popup (hue ring + saturation/brightness square)
---------------------------------------------------------------------
do
local GuiService = game:GetService("GuiService")
local panel = Instance.new("Frame")
panel.Name = "ColorPicker"
panel.Size = UDim2.fromOffset(190, 300)
panel.Position = UDim2.new(1, 8, 0, 0)
panel.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
panel.BorderSizePixel = 0
panel.Active = true
panel.Visible = false
panel.ZIndex = 5
panel.Parent = frame
corner(panel, 12)
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 26)
title.Position = UDim2.fromOffset(0, 4)
title.BackgroundTransparency = 1
title.Text = "Pick a color"
title.Font = theme.font
title.TextSize = 20
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.ZIndex = 6
title.Parent = panel
-- geometry (inside the panel)
local CX, CY = 95, 112
local OUTER, THICK = 80, 16
local MID = OUTER - THICK / 2
local SV = 84
-- the hue ring: 90 little rotated pieces
for i = 0, 89 do
local ang = (i / 90) * 2 * math.pi
local seg = Instance.new("Frame")
seg.AnchorPoint = Vector2.new(0.5, 0.5)
seg.Size = UDim2.fromOffset(7, THICK)
seg.Position = UDim2.fromOffset(CX + math.cos(ang) * MID, CY + math.sin(ang) * MID)
seg.Rotation = math.deg(ang) - 90
seg.BackgroundColor3 = Color3.fromHSV(i / 90, 1, 1)
seg.BorderSizePixel = 0
seg.ZIndex = 6
seg.Parent = panel
end
-- the square in the middle: saturation (left to right) and brightness (top to bottom)
local svBox = Instance.new("Frame")
svBox.Size = UDim2.fromOffset(SV, SV)
svBox.Position = UDim2.fromOffset(CX - SV / 2, CY - SV / 2)
svBox.BorderSizePixel = 0
svBox.ZIndex = 6
svBox.Parent = panel
local white = Instance.new("Frame")
white.Size = UDim2.fromScale(1, 1)
white.BackgroundColor3 = Color3.new(1, 1, 1)
white.BorderSizePixel = 0
white.ZIndex = 7
white.Parent = svBox
local whiteGrad = Instance.new("UIGradient")
whiteGrad.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(1, 1) })
whiteGrad.Parent = white
local black = Instance.new("Frame")
black.Size = UDim2.fromScale(1, 1)
black.BackgroundColor3 = Color3.new(0, 0, 0)
black.BorderSizePixel = 0
black.ZIndex = 8
black.Parent = svBox
local blackGrad = Instance.new("UIGradient")
blackGrad.Rotation = 90
blackGrad.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0) })
blackGrad.Parent = black
local function makeMarker()
local m = Instance.new("Frame")
m.AnchorPoint = Vector2.new(0.5, 0.5)
m.Size = UDim2.fromOffset(14, 14)
m.BackgroundTransparency = 1
m.ZIndex = 9
m.Parent = panel
corner(m, 7)
local st = Instance.new("UIStroke")
st.Color = Color3.new(1, 1, 1)
st.Thickness = 2
st.Parent = m
return m
end
local hueMarker = makeMarker()
local svMarker = makeMarker()
-- preview + hex + done
local preview = Instance.new("Frame")
preview.Size = UDim2.fromOffset(50, 34)
preview.Position = UDim2.fromOffset(20, 208)
preview.BorderSizePixel = 0
preview.ZIndex = 6
preview.Parent = panel
corner(preview, 8)
local hexLabel = Instance.new("TextLabel")
hexLabel.Size = UDim2.fromOffset(100, 34)
hexLabel.Position = UDim2.fromOffset(80, 208)
hexLabel.BackgroundTransparency = 1
hexLabel.TextXAlignment = Enum.TextXAlignment.Left
hexLabel.Font = theme.font
hexLabel.TextSize = 18
hexLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
hexLabel.ZIndex = 6
hexLabel.Parent = panel
local doneBtn = Instance.new("TextButton")
doneBtn.Size = UDim2.fromOffset(150, 34)
doneBtn.Position = UDim2.fromOffset(20, 254)
doneBtn.BackgroundColor3 = Color3.fromRGB(60, 120, 220)
doneBtn.BorderSizePixel = 0
doneBtn.Text = "done"
doneBtn.Font = theme.font
doneBtn.TextSize = 18
doneBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
doneBtn.ZIndex = 6
doneBtn.Parent = panel
corner(doneBtn, 8)
-- state
local h, sat, val = 0, 1, 1
local callback = nil
local function refresh()
local ang = h * 2 * math.pi
svBox.BackgroundColor3 = Color3.fromHSV(h, 1, 1)
hueMarker.Position = UDim2.fromOffset(CX + math.cos(ang) * MID, CY + math.sin(ang) * MID)
svMarker.Position = UDim2.fromOffset(CX - SV / 2 + sat * SV, CY - SV / 2 + (1 - val) * SV)
local c = Color3.fromHSV(h, sat, val)
preview.BackgroundColor3 = c
hexLabel.Text = "#" .. c:ToHex():upper()
end
-- dragging on the wheel
local hit = Instance.new("Frame")
hit.Size = UDim2.fromOffset((OUTER + 6) * 2, (OUTER + 6) * 2)
hit.Position = UDim2.fromOffset(CX - OUTER - 6, CY - OUTER - 6)
hit.BackgroundTransparency = 1
hit.Active = true
hit.ZIndex = 10
hit.Parent = panel
local dragMode, dragInput
local function pointerPos(input)
if input.UserInputType == Enum.UserInputType.Touch then
return Vector2.new(input.Position.X, input.Position.Y)
end
return UserInputService:GetMouseLocation() - GuiService:GetGuiInset()
end
local function update()
local p = pointerPos(dragInput) - panel.AbsolutePosition
if dragMode == "hue" then
h = (math.atan2(p.Y - CY, p.X - CX) % (2 * math.pi)) / (2 * math.pi)
elseif dragMode == "sv" then
sat = math.clamp((p.X - (CX - SV / 2)) / SV, 0, 1)
val = 1 - math.clamp((p.Y - (CY - SV / 2)) / SV, 0, 1)
end
refresh()
if callback then callback(Color3.fromHSV(h, sat, val)) end
end
hit.InputBegan:Connect(function(input)
if dragInput then return end
if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
local p = pointerPos(input) - panel.AbsolutePosition
local dx, dy = p.X - CX, p.Y - CY
local dist = math.sqrt(dx * dx + dy * dy)
if dist >= OUTER - THICK - 6 and dist <= OUTER + 6 then
dragMode = "hue"
elseif math.abs(dx) <= SV / 2 + 4 and math.abs(dy) <= SV / 2 + 4 then
dragMode = "sv"
else
return
end
dragInput = input
update()
end)
RunService.RenderStepped:Connect(function()
if dragInput then update() end
end)
UserInputService.InputEnded:Connect(function(input)
if not dragInput then return end
local sameMouse = input.UserInputType == Enum.UserInputType.MouseButton1 and dragInput.UserInputType == Enum.UserInputType.MouseButton1
if input == dragInput or sameMouse then
dragInput = nil
end
end)
local function close()
panel.Visible = false
callback = nil
dragInput = nil
end
themeHooks.closePicker = close
doneBtn.MouseButton1Click:Connect(close)
-- open the wheel starting at `initial`; `onChange(color)` runs while you drag
function ui.pickColor(initial, onChange)
callback = nil
h, sat, val = initial:ToHSV()
refresh()
callback = onChange
sidebar.Visible = false
panel.Visible = true
end
end
-- a button that shows a colour swatch and opens the wheel when pressed
function ui.colorRow(parent, text, position, getColor, setColor, name)
local b, label = ui.studButton(parent, text, position, UDim2.fromOffset(192, 56), Color3.fromRGB(60, 120, 220), name)
label.Size = UDim2.new(1, -56, 1, -16)
local swatch = Instance.new("Frame")
swatch.AnchorPoint = Vector2.new(1, 0.5)
swatch.Size = UDim2.fromOffset(30, 30)
swatch.Position = UDim2.new(1, -10, 0.5, 0)
swatch.BackgroundColor3 = getColor()
swatch.BorderSizePixel = 0
swatch.ZIndex = 3
swatch.Parent = b
corner(swatch, 15)
local stroke = Instance.new("UIStroke")
stroke.Color = Color3.new(1, 1, 1)
stroke.Thickness = 2
stroke.Parent = swatch
b.MouseButton1Click:Connect(function()
ui.pickColor(getColor(), function(c)
setColor(c)
swatch.BackgroundColor3 = c
end)
end)
return function() swatch.BackgroundColor3 = getColor() end -- call to refresh the swatch
end
---------------------------------------------------------------------
-- Chat tab: message style (font, text colour, outline colour)
---------------------------------------------------------------------
do
local DEFAULT_COLOR = Color3.fromRGB(57, 59, 61)
local BLUE = Color3.fromRGB(60, 120, 220)
local heading = Instance.new("TextLabel")
heading.Name = "MessageStyleHeading"
heading.Size = UDim2.new(0, 436, 0, 24)
heading.Position = UDim2.fromOffset(22, 236)
heading.BackgroundTransparency = 1
heading.Text = "Message style (bubbles)"
heading.Font = theme.font
heading.TextScaled = true
heading.TextColor3 = theme.textColor
heading.ZIndex = 3
heading:SetAttribute("ThemeText", true)
heading.Parent = chatContent
local fontBtn, fontLabel = ui.studButton(chatContent, "Font: " .. chatStyle.font.Name, UDim2.fromOffset(22, 264), UDim2.fromOffset(192, 56), BLUE, "MsgFontBtn")
fontBtn.MouseButton1Click:Connect(function()
chatStyle.font = ui.nextFont(chatStyle.font)
fontLabel.Text = "Font: " .. chatStyle.font.Name
end)
local refreshText = ui.colorRow(chatContent, "Text color", UDim2.fromOffset(266, 264),
function() return chatStyle.color end,
function(c)
chatStyle.color = c
chatStyle.colorSet = true
end, "MsgColorBtn")
local refreshOutline = ui.colorRow(chatContent, "Outline color", UDim2.fromOffset(22, 328),
function() return chatStyle.outline or Color3.new(0, 0, 0) end,
function(c) chatStyle.outline = c end, "MsgOutlineBtn")
local resetBtn = ui.studButton(chatContent, "reset style", UDim2.fromOffset(266, 328), UDim2.fromOffset(192, 56), BLUE, "MsgResetBtn")
resetBtn.MouseButton1Click:Connect(function()
chatStyle.font = Enum.Font.GothamMedium
chatStyle.color = DEFAULT_COLOR
chatStyle.colorSet = false
chatStyle.outline = nil
fontLabel.Text = "Font: " .. chatStyle.font.Name
refreshText()
refreshOutline()
end)
local pad = Instance.new("Frame")
pad.BackgroundTransparency = 1
pad.Size = UDim2.fromOffset(10, 10)
pad.Position = UDim2.fromOffset(0, 396)
pad.Parent = chatContent
end
---------------------------------------------------------------------
-- Fun tab: spectate, teleports, lighting, camera and more
---------------------------------------------------------------------
do
local Lighting = game:GetService("Lighting")
local page = ui.page("Fun")
makeTab("Fun", 5)
tabs.Fun.MouseButton1Click:Connect(function() setTab("Fun") end)
ui.subtitle(page, "fun stuff")
-- target box + select button (used by spectate / teleport to)
local holder = studBackground(page, "FunTargetHolder", UDim2.new(0, 280, 0, 46), UDim2.fromOffset(22, 100), Color3.fromRGB(255, 255, 255))
holder.ZIndex = 2
local funUser = makeTextBox(holder, "FunTarget", "Type a player's username")
funUser.ZIndex = 3
funUser:SetAttribute("ThemeText", true)
local selectFun = Instance.new("TextButton")
selectFun.Name = "FunSelectBtn"
selectFun.Size = UDim2.fromOffset(146, 46)
selectFun.Position = UDim2.fromOffset(312, 100)
selectFun.BackgroundColor3 = Color3.fromRGB(60, 120, 220)
selectFun.BorderSizePixel = 0
selectFun.Text = "select player"
selectFun.Font = FONT
selectFun.TextSize = 16
selectFun.TextColor3 = Color3.fromRGB(255, 255, 255)
selectFun.ZIndex = 3
selectFun.Parent = page
corner(selectFun, 8)
selectFun.MouseButton1Click:Connect(function()
sidebarTarget = funUser
sidebar.Visible = not sidebar.Visible
if sidebar.Visible then refreshPlayerList() end
end)
local content = ui.scroller(page, "FunContent", UDim2.fromOffset(0, 154), UDim2.new(1, 0, 1, -160))
local half = UDim2.fromOffset(192, 52)
local function target()
local plr = findPlayer(funUser.Text)
if not plr or plr == player then return nil end
local char = plr.Character
if not char then return nil end
return plr, char:FindFirstChild("HumanoidRootPart"), char:FindFirstChildOfClass("Humanoid")
end
-- a button that briefly shows a message on itself
local function flashLabel(label, text, original)
task.spawn(function()
label.Text = text
task.wait(1)
label.Text = original
end)
end
-- spectate: camera follows the target
local spectating = false
local setSpectateVisual
local function stopSpectate()
spectating = false
local cam, hum = workspace.CurrentCamera, getHumanoid()
if cam and hum then cam.CameraSubject = hum end
end
setSpectateVisual = makeToggle("Spectate", UDim2.fromOffset(22, 4), function(on)
if on then
if not target() then
setSpectateVisual(false)
return
end
spectating = true
else
stopSpectate()
end
end, content, half)
RunService.RenderStepped:Connect(function()
if not spectating then return end
local _, _, thum = target()
local cam = workspace.CurrentCamera
if thum and cam.CameraSubject ~= thum then cam.CameraSubject = thum end
end)
-- teleport to the target
local tpBtn, tpLabel = ui.studButton(content, "teleport to", UDim2.fromOffset(266, 4), half, theme.enabledColor, "FunTeleportBtn")
tpBtn.MouseButton1Click:Connect(function()
local _, troot = target()
local root = getRoot()
if troot and root then
root.CFrame = troot.CFrame * CFrame.new(0, 0, 3)
else
flashLabel(tpLabel, "no target!", "teleport to")
end
end)
-- click teleport: with the toggle on, click (PC) or tap (mobile) the world to teleport there
local clickTp = false
UserInputService.InputBegan:Connect(function(input, processed)
if not clickTp or processed then return end
local isClick = input.UserInputType == Enum.UserInputType.MouseButton1
local isTap = input.UserInputType == Enum.UserInputType.Touch
if not (isClick or isTap) then return end
local root, cam = getRoot(), workspace.CurrentCamera
if not root or not cam then return end
local ray = cam:ScreenPointToRay(input.Position.X, input.Position.Y)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = { player.Character }
local result = workspace:Raycast(ray.Origin, ray.Direction * 2000, params)
if result then
root.CFrame = CFrame.new(result.Position + Vector3.new(0, 3, 0))
root.AssemblyLinearVelocity = Vector3.zero
end
end)
makeToggle("Click TP", UDim2.fromOffset(22, 62), function(on) clickTp = on end, content, half)
-- fullbright (only changes your own lighting)
local savedLighting
makeToggle("Fullbright", UDim2.fromOffset(266, 62), function(on)
if on then
savedLighting = {
Brightness = Lighting.Brightness,
ClockTime = Lighting.ClockTime,
FogEnd = Lighting.FogEnd,
GlobalShadows = Lighting.GlobalShadows,
Ambient = Lighting.Ambient,
OutdoorAmbient = Lighting.OutdoorAmbient,
}
Lighting.Brightness = 2
Lighting.ClockTime = 14
Lighting.FogEnd = 1e6
Lighting.GlobalShadows = false
Lighting.Ambient = Color3.new(1, 1, 1)
Lighting.OutdoorAmbient = Color3.new(1, 1, 1)
elseif savedLighting then
for prop, value in pairs(savedLighting) do Lighting[prop] = value end
savedLighting = nil
end
end, content, half)
-- rainbow body: a colour-cycling glow over your whole character (only you see it)
local rainbow = false
local rainbowGlow
RunService.RenderStepped:Connect(function()
if not rainbow then return end
local char = player.Character
if not char then return end
if not rainbowGlow or rainbowGlow.Parent ~= char then
if rainbowGlow then rainbowGlow:Destroy() end
rainbowGlow = Instance.new("Highlight")
rainbowGlow.Name = "TrollHubRainbow"
rainbowGlow.FillTransparency = 0.15
rainbowGlow.OutlineTransparency = 0.3
rainbowGlow.DepthMode = Enum.HighlightDepthMode.Occluded
rainbowGlow.Adornee = char
rainbowGlow.Parent = char
end
local color = Color3.fromHSV((os.clock() * 0.5) % 1, 1, 1)
rainbowGlow.FillColor = color
rainbowGlow.OutlineColor = color
end)
makeToggle("Rainbow body", UDim2.fromOffset(22, 120), function(on)
rainbow = on
if not on and rainbowGlow then
rainbowGlow:Destroy()
rainbowGlow = nil
end
end, content, half)
-- reset your character
local resetMe = ui.studButton(content, "reset me", UDim2.fromOffset(266, 120), half, theme.enabledColor, "FunResetMeBtn")
resetMe.MouseButton1Click:Connect(function()
local hum = getHumanoid()
if hum then hum.Health = 0 end
end)
-- waypoint
local waypoint
local setBtn, setLabel = ui.studButton(content, "set waypoint", UDim2.fromOffset(22, 178), half, theme.enabledColor, "FunWaypointSetBtn")
setBtn.MouseButton1Click:Connect(function()
local root = getRoot()
if root then
waypoint = root.CFrame
flashLabel(setLabel, "saved!", "set waypoint")
end
end)
local goBtn, goLabel = ui.studButton(content, "go to waypoint", UDim2.fromOffset(266, 178), half, theme.enabledColor, "FunWaypointGoBtn")
goBtn.MouseButton1Click:Connect(function()
local root = getRoot()
if root and waypoint then
root.CFrame = waypoint
else
flashLabel(goLabel, "none saved!", "go to waypoint")
end
end)
-- number boxes: field of view, gravity, time of day (empty = back to normal)
local originalGravity = workspace.Gravity
local originalClock = Lighting.ClockTime
local fovBox = ui.input(content, "FunFov", "Field of view (70)", UDim2.fromOffset(22, 236), half)
fovBox.FocusLost:Connect(function()
local cam = workspace.CurrentCamera
local n = tonumber(fovBox.Text)
if fovBox.Text:gsub("%s", "") == "" then
cam.FieldOfView = 70
elseif n then
cam.FieldOfView = math.clamp(n, 1, 120)
else
ui.flashInvalid(fovBox, "type a number")
end
end)
local gravityBox = ui.input(content, "FunGravity", "Gravity (196.2)", UDim2.fromOffset(266, 236), half)
gravityBox.FocusLost:Connect(function()
local n = tonumber(gravityBox.Text)
if gravityBox.Text:gsub("%s", "") == "" then
workspace.Gravity = originalGravity
elseif n then
workspace.Gravity = math.clamp(n, 0, 1000)
else
ui.flashInvalid(gravityBox, "type a number")
end
end)
local timeBox = ui.input(content, "FunTime", "Time of day (0-24)", UDim2.fromOffset(22, 294), half)
timeBox.FocusLost:Connect(function()
local n = tonumber(timeBox.Text)
if timeBox.Text:gsub("%s", "") == "" then
Lighting.ClockTime = originalClock
elseif n then
Lighting.ClockTime = math.clamp(n, 0, 24)
else
ui.flashInvalid(timeBox, "type a number 0-24")
end
end)
shared.fun = { content = content, half = half, setStatus = setStatus }
local pad = Instance.new("Frame")
pad.BackgroundTransparency = 1
pad.Size = UDim2.fromOffset(10, 10)
pad.Position = UDim2.fromOffset(0, 600)
pad.Parent = content
end
---------------------------------------------------------------------
-- Fun tab, part 2: avatar sizer + walk on walls
---------------------------------------------------------------------
do
local content, half, setStatus = shared.fun.content, shared.fun.half, shared.fun.setStatus
-- joint helpers shared with the JOHN DOE / HACKER poses. They find the joints on R15 and R6
-- characters, and turn "swing the arm forward 1 radian" into the right rotation for each rig.
shared.keepTracks = setmetatable({}, { __mode = "k" })
local JOINT_NAMES = {
RightShoulder = { "RightShoulder", "Right Shoulder" },
LeftShoulder = { "LeftShoulder", "Left Shoulder" },
RightHip = { "RightHip", "Right Hip" },
LeftHip = { "LeftHip", "Left Hip" },
Neck = { "Neck" },
Waist = { "Waist", "RootJoint" },
RightElbow = { "RightElbow" },
LeftElbow = { "LeftElbow" },
RightKnee = { "RightKnee" },
LeftKnee = { "LeftKnee" },
}
function shared.findJoints(char)
local list, byName = {}, {}
for _, d in ipairs(char:GetDescendants()) do
if d:IsA("Motor6D") then
table.insert(list, d)
byName[d.Name] = d
end
end
local map = {}
for logical, names in pairs(JOINT_NAMES) do
for _, name in ipairs(names) do
if byName[name] then
map[logical] = byName[name]
break
end
end
end
return list, map
end
function shared.applyJoint(motor, x, y, z)
local c0 = motor.C0
local rotation = c0 - c0.Position
motor.Transform = rotation:Inverse() * CFrame.Angles(x, y, z) * rotation
end
-- play real animation ids on your character. These go through the normal animation system,
-- so other players see them wherever that animation id is allowed to play.
do
table.insert(ENABLED_NAMES, "FunAnimPlayBtn")
table.insert(ENABLED_NAMES, "FunAnimStopBtn")
local playing = {}
local speed = 1
local idBox = ui.input(content, "FunAnimIds", "Animation id(s)", UDim2.fromOffset(22, 468), half)
local playBtn = ui.studButton(content, "play animation", UDim2.fromOffset(266, 468), half, theme.enabledColor, "FunAnimPlayBtn")
playBtn.MouseButton1Click:Connect(function()
local hum = getHumanoid()
local animator = hum and hum:FindFirstChildOfClass("Animator")
if not animator then
setStatus("no animator found")
return
end
local count = 0
for id in idBox.Text:gmatch("%d+") do
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://" .. id
local ok, track = pcall(function() return animator:LoadAnimation(anim) end)
if ok and track then
track.Priority = Enum.AnimationPriority.Action
track:Play(0.1, 1, speed)
shared.keepTracks[track] = true
table.insert(playing, track)
count += 1
end
end
setStatus(count > 0 and ("playing " .. count .. " animation(s)") or "type an animation id first")
end)
local stopBtn = ui.studButton(content, "stop animations", UDim2.fromOffset(22, 526), half, theme.enabledColor, "FunAnimStopBtn")
stopBtn.MouseButton1Click:Connect(function()
for _, track in ipairs(playing) do pcall(function() track:Stop(0.1) end) end
playing = {}
end)
local speedBox = ui.input(content, "FunAnimSpeed", "Animation speed (1)", UDim2.fromOffset(266, 526), half)
speedBox.FocusLost:Connect(function()
local n = tonumber(speedBox.Text)
if speedBox.Text:gsub("%s", "") == "" then
speed = 1
elseif n then
speed = math.clamp(n, 0, 10)
else
ui.flashInvalid(speedBox, "type a number")
return
end
for _, track in ipairs(playing) do pcall(function() track:AdjustSpeed(speed) end) end
end)
end
-- avatar sizer: any size you like (local to your screen)
local baseScale
local function applySize(n)
local char = player.Character
if not char then return end
if not baseScale then baseScale = char:GetScale() end
local ok, err = pcall(function() char:ScaleTo(baseScale * n) end)
if ok then
setStatus("avatar size x" .. n)
else
setStatus("couldn't resize: " .. tostring(err):sub(1, 50))
end
end
player.CharacterAdded:Connect(function() baseScale = nil end)
local sizeBox = ui.input(content, "FunAvatarSize", "Avatar size (1 = normal)", UDim2.fromOffset(22, 352), half)
sizeBox.FocusLost:Connect(function()
local n = tonumber(sizeBox.Text)
if sizeBox.Text:gsub("%s", "") == "" then
applySize(1)
elseif n and n > 0 then
applySize(math.clamp(n, 0.05, 100))
else
ui.flashInvalid(sizeBox, "type a number above 0")
end
end)
local resetSizeBtn = ui.studButton(content, "reset size", UDim2.fromOffset(266, 352), half, theme.enabledColor, "FunResetSizeBtn")
resetSizeBtn.MouseButton1Click:Connect(function()
sizeBox.Text = ""
applySize(1)
end)
-- walk on walls (PC: WASD move, Space jump, hold right mouse to look, wheel to zoom)
local setWallVisual
do
local ContextActionService = game:GetService("ContextActionService")
local WALL_KEYS = { Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space }
local active = false
local up, targetUp = Vector3.yAxis, Vector3.yAxis
local lookDir = Vector3.new(0, 0, -1)
local facing = Vector3.new(0, 0, -1)
local zoom = 14
local looking = false
local vertVel, airTime, jumpHeld = 0, 0, false
local offsetBase, scaleBase = 3, 1 -- feet-to-body-center distance at the size we started at
local lastMoving, lastGrounded = false, true
local wallMotors, wallAnimate, wallPhase = {}, nil, 0
local function charScale()
local char = player.Character
local ok, value = pcall(function() return char:GetScale() end)
return (ok and value) or 1
end
-- how far the body center is above the soles of the feet (works at any avatar size)
local function feetOffset(char, root)
local lowest = root.Position.Y - root.Size.Y / 2
for _, name in ipairs({ "LeftFoot", "RightFoot", "LeftLowerLeg", "RightLowerLeg", "Left Leg", "Right Leg" }) do
local part = char:FindFirstChild(name)
if part and part:IsA("BasePart") then
lowest = math.min(lowest, part.Position.Y - part.Size.Y / 2)
end
end
return root.Position.Y - lowest
end
local function down(k) return UserInputService:IsKeyDown(k) end
local function rotateWith(vector, fromUp, toUp)
local axis = fromUp:Cross(toUp)
if axis.Magnitude < 1e-4 then return vector end
local angle = math.acos(math.clamp(fromUp:Dot(toUp), -1, 1))
return CFrame.fromAxisAngle(axis.Unit, angle):VectorToWorldSpace(vector)
end
RunService.Heartbeat:Connect(function(dt)
if not active then return end
local hum, root = getHumanoid(), getRoot()
if not (hum and root) then return end
-- turn smoothly toward the surface we're standing on (camera and facing turn with it)
local previousUp = up
local blended = up:Lerp(targetUp, math.min(1, dt * 12))
if blended.Magnitude > 0.01 then up = blended.Unit end
lookDir = rotateWith(lookDir, previousUp, up)
facing = rotateWith(facing, previousUp, up)
local ix, iz, wantJump = 0, 0, false
if not UserInputService:GetFocusedTextBox() then
if down(Enum.KeyCode.D) then ix += 1 end
if down(Enum.KeyCode.A) then ix -= 1 end
if down(Enum.KeyCode.S) then iz += 1 end
if down(Enum.KeyCode.W) then iz -= 1 end
wantJump = down(Enum.KeyCode.Space)
end
local fwd = lookDir - up * lookDir:Dot(up)
if fwd.Magnitude < 0.05 then fwd = facing - up * facing:Dot(up) end
if fwd.Magnitude < 0.05 then fwd = Vector3.new(0, 0, -1) end
fwd = fwd.Unit
local right = fwd:Cross(up).Unit
local dir = fwd * (-iz) + right * ix
local moving = dir.Magnitude > 0.01
if moving then
dir = dir.Unit
facing = dir
end
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = { player.Character }
local sc = charScale()
local offset = offsetBase * sc / scaleBase
local pos = root.Position
local g = workspace.Gravity
-- the ground under our feet, relative to our own "down"
local ground = workspace:Raycast(pos, -up * (offset + 1.2 * sc), params)
local grounded = ground ~= nil and vertVel <= 0.5
if grounded then
vertVel, airTime = 0, 0
targetUp = ground.Normal
if wantJump and not jumpHeld then
vertVel = hum.UseJumpPower and hum.JumpPower or math.sqrt(2 * g * hum.JumpHeight)
grounded = false
end
else
airTime += dt
vertVel -= g * dt
if airTime > 0.8 then targetUp = Vector3.yAxis end -- fell off: back to normal gravity
end
jumpHeld = wantJump
lastMoving, lastGrounded = moving, grounded
local newPos = pos + up * (vertVel * dt)
if moving then newPos += dir * hum.WalkSpeed * dt end
if grounded then
-- stay exactly one body-height above the surface
newPos += up * ((ground.Position + up * offset - newPos):Dot(up))
end
if moving then
local wall = workspace:Raycast(pos, dir * 2.5 * sc, params)
if wall and wall.Normal:Dot(up) < 0.6 then
-- a wall in front of us: climb onto it
targetUp = wall.Normal
newPos = wall.Position + wall.Normal * offset
vertVel = 0
elseif not ground and airTime < 0.3 then
-- the surface ended (an edge): wrap around to the side we just walked off
local edge = workspace:Raycast(pos + dir * 2 * sc - up * (offset * 0.7), -dir * 3 * sc, params)
if edge then
targetUp = edge.Normal
newPos = edge.Position + edge.Normal * offset
vertVel, airTime = 0, 0
end
end
end
local face = facing - up * facing:Dot(up)
if face.Magnitude < 0.05 then face = fwd end
root.CFrame = CFrame.lookAt(newPos, newPos + face.Unit, up)
root.AssemblyLinearVelocity = Vector3.zero
root.AssemblyAngularVelocity = Vector3.zero
end)
-- its own simple walking pose (the game's animations can't follow a sideways character)
RunService:BindToRenderStep("TrollHubWallPose", Enum.RenderPriority.Last.Value, function(dt)
if not active or shared.poseOwner then return end
local char = player.Character
if not char then return end
local animate = char:FindFirstChild("Animate")
if animate and not animate.Disabled then
pcall(function() animate.Disabled = true end)
wallAnimate = animate
end
wallPhase += dt * ((lastMoving and lastGrounded) and 10 or 0)
local s = math.sin(wallPhase)
local angles = {}
if not lastGrounded then
angles.RightShoulder = Vector3.new(0, 0, 1.0)
angles.LeftShoulder = Vector3.new(0, 0, -1.0)
angles.RightHip = Vector3.new(0, 0, 0.15)
angles.LeftHip = Vector3.new(0, 0, -0.15)
elseif lastMoving then
angles.RightShoulder = Vector3.new(s * 0.8, 0, 0)
angles.LeftShoulder = Vector3.new(-s * 0.8, 0, 0)
angles.RightHip = Vector3.new(-s * 0.8, 0, 0)
angles.LeftHip = Vector3.new(s * 0.8, 0, 0)
angles.RightKnee = Vector3.new(-math.max(0, s) * 0.7, 0, 0)
angles.LeftKnee = Vector3.new(-math.max(0, -s) * 0.7, 0, 0)
end
for _, name in ipairs({ "RightShoulder", "LeftShoulder", "RightHip", "LeftHip", "RightKnee", "LeftKnee" }) do
local motor = wallMotors[name]
if motor and motor.Parent then
local a = angles[name] or Vector3.zero
shared.applyJoint(motor, a.X, a.Y, a.Z)
end
end
end)
RunService:BindToRenderStep("TrollHubWallCamera", Enum.RenderPriority.Camera.Value + 1, function()
if not active then return end
local root, cam = getRoot(), workspace.CurrentCamera
if not (root and cam) then return end
local sc = charScale()
local focus = root.Position + up * 2 * sc
cam.CFrame = CFrame.lookAt(focus - lookDir * zoom * sc, focus, up)
end)
UserInputService.InputBegan:Connect(function(input)
if active and input.UserInputType == Enum.UserInputType.MouseButton2 then
looking = true
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 and looking then
looking = false
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end)
UserInputService.InputChanged:Connect(function(input)
if not active then return end
if input.UserInputType == Enum.UserInputType.MouseMovement and looking then
local side = lookDir:Cross(up)
lookDir = CFrame.fromAxisAngle(up, -input.Delta.X * 0.004):VectorToWorldSpace(lookDir)
if side.Magnitude > 0.01 then
local pitched = CFrame.fromAxisAngle(side.Unit, -input.Delta.Y * 0.004):VectorToWorldSpace(lookDir)
if math.abs(pitched:Dot(up)) < 0.97 then lookDir = pitched end
end
elseif input.UserInputType == Enum.UserInputType.MouseWheel then
zoom = math.clamp(zoom * (1 - 0.1 * input.Position.Z), 4, 80)
end
end)
local function enable()
local hum, root, cam = getHumanoid(), getRoot(), workspace.CurrentCamera
if not (hum and root and cam) then return false end
active = true
up, targetUp = Vector3.yAxis, Vector3.yAxis
lookDir = cam.CFrame.LookVector
facing = Vector3.new(lookDir.X, 0, lookDir.Z)
if facing.Magnitude < 0.05 then facing = Vector3.new(0, 0, -1) end
facing = facing.Unit
vertVel, airTime = 0, 0
hum.PlatformStand = true
local char = player.Character
offsetBase, scaleBase = feetOffset(char, root), charScale()
wallPhase = 0
local _, joints = shared.findJoints(char)
wallMotors = joints
local animator = hum:FindFirstChildOfClass("Animator")
if animator then
for _, track in ipairs(animator:GetPlayingAnimationTracks()) do track:Stop(0.1) end
end
hum.AutoRotate = false
cam.CameraType = Enum.CameraType.Scriptable
ContextActionService:BindActionAtPriority("TrollHubWallWalk", function()
return Enum.ContextActionResult.Sink
end, false, Enum.ContextActionPriority.High.Value, unpack(WALL_KEYS))
setStatus("walk on walls: WASD move, Space jump, hold right mouse to look, wheel zoom", 7)
return true
end
local function disable()
active, looking = false, false
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
ContextActionService:UnbindAction("TrollHubWallWalk")
for _, motor in pairs(wallMotors) do
if motor.Parent then motor.Transform = CFrame.new() end
end
wallMotors = {}
if wallAnimate and not shared.poseOwner then
pcall(function() wallAnimate.Disabled = false end)
end
wallAnimate = nil
local hum, root, cam = getHumanoid(), getRoot(), workspace.CurrentCamera
if hum then
hum.PlatformStand = false
hum.AutoRotate = true
end
if root then
local face = Vector3.new(facing.X, 0, facing.Z)
if face.Magnitude < 0.05 then face = Vector3.new(0, 0, -1) end
root.CFrame = CFrame.lookAt(root.Position, root.Position + face)
root.AssemblyLinearVelocity = Vector3.zero
end
if cam then
cam.CameraType = Enum.CameraType.Custom
if hum then cam.CameraSubject = hum end
end
end
setWallVisual = makeToggle("Walk on walls", UDim2.fromOffset(22, 410), function(on)
if on then
if not enable() then setWallVisual(false) end
else
disable()
end
end, content, half)
player.CharacterAdded:Connect(function()
if active then
disable()
setWallVisual(false)
end
end)
end
end
---------------------------------------------------------------------
-- LARPS tab: fake limiteds, headless, korblox, and turning into other players
-- (client-side: it only changes how YOU see things)
--
-- How it works: Roblox builds a full copy of your avatar (with your changes)
-- as a local model. Your real character is hidden and the copy follows it.
-- The copy plays the same animations your real character plays (so your
-- walk, run, emotes etc. carry over). When you turn into another player,
-- your idle/walk/run/jump/fall/climb/swim animations are swapped for the
-- ones that player has equipped, and their emotes show up as buttons.
-- Your real character is never changed, so nothing can break or kill you.
---------------------------------------------------------------------
do
-- add more here: { name = "...", id = <catalog number from the item's URL> }
local LARP_ITEMS = {
{ name = "Valkyrie Helm", id = 1365767 },
{ name = "Dominus Empyreus", id = 21070012 },
}
local HEADLESS_ID = 134082579 -- Headless Horseman head
local KORBLOX_ID = 139607718 -- Korblox Deathspeaker right leg
-- the accessory types we try when working out what kind of item an id is
local ACCESSORY_TYPES = {
Enum.AccessoryType.Hat, Enum.AccessoryType.Hair, Enum.AccessoryType.Face, Enum.AccessoryType.Neck,
Enum.AccessoryType.Shoulder, Enum.AccessoryType.Front, Enum.AccessoryType.Back, Enum.AccessoryType.Waist,
}
-- keep your own body proportions
local SCALE_MAP = {
BodyHeightScale = "HeightScale",
BodyWidthScale = "WidthScale",
BodyDepthScale = "DepthScale",
HeadScale = "HeadScale",
BodyTypeScale = "BodyTypeScale",
BodyProportionScale = "ProportionScale",
}
-- which animation folder in your Animate script matches which avatar animation slot
local ROLE_PROPS = {
idle = "IdleAnimation", walk = "WalkAnimation", run = "RunAnimation",
jump = "JumpAnimation", fall = "FallAnimation", climb = "ClimbAnimation",
swim = "SwimAnimation", swimidle = "SwimAnimation",
}
local page = ui.page("LARPS")
makeTab("LARPS", 6)
tabs.LARPS.MouseButton1Click:Connect(function() setTab("LARPS") end)
local subtitle = ui.subtitle(page, "larp stuff")
local statusToken = 0
local function setStatus(text)
statusToken += 1
local mine = statusToken
subtitle.Text = text
task.delay(4, function()
if statusToken == mine then subtitle.Text = "larp stuff" end
end)
end
local content = ui.scroller(page, "LarpContent", UDim2.fromOffset(0, 98), UDim2.new(1, 0, 1, -104))
local half = UDim2.fromOffset(192, 52)
local function rowY(r) return 4 + r * 58 end
-- state
local larp = { headless = false, korblox = false, toggled = {} }
local customItems = {}
local myDescription, becomeDescription
local accessoryTypeCache = {}
local applying, pending = false, false
local dummy, mirrorConn, collideConn, animConn
local transparencyPairs, dummyParts = {}, {}
local savedTransparency = {}
local dummyAnimator
local roleIdMap = {} -- your animation id -> the animation id to play instead
local mirrored = {} -- your track -> { track = copy's track, mapped = bool }
local badAnimIds = {} -- their animation ids that failed to load (so we don't wait on them again)
---------------------------------------------------------------
-- hide / show your real character
---------------------------------------------------------------
local function hideMyCharacter()
local char = player.Character
if not char then return end
for _, d in ipairs(char:GetDescendants()) do
if (d:IsA("BasePart") or d:IsA("Decal")) and savedTransparency[d] == nil then
savedTransparency[d] = d.Transparency
d.Transparency = 1
end
end
end
local function showMyCharacter()
for obj, t in pairs(savedTransparency) do
if obj.Parent then obj.Transparency = t end
end
savedTransparency = {}
end
local function removeDummy()
if mirrorConn then mirrorConn:Disconnect() mirrorConn = nil end
if collideConn then collideConn:Disconnect() collideConn = nil end
if animConn then animConn:Disconnect() animConn = nil end
for _, info in pairs(mirrored) do
pcall(function() info.track:Stop(0) end)
end
mirrored = {}
if dummy then
dummy:Destroy()
dummy = nil
end
dummyAnimator = nil
transparencyPairs, dummyParts = {}, {}
showMyCharacter()
end
---------------------------------------------------------------
-- animations: the copy plays what your real character plays
---------------------------------------------------------------
local function animIdOf(animation)
return tostring(animation.AnimationId):match("%d+")
end
local function loadCopyTrack(animationId)
local copy = Instance.new("Animation")
copy.AnimationId = animationId
local ok, track = pcall(function() return dummyAnimator:LoadAnimation(copy) end)
if ok then return track end
return nil
end
local function mirrorTrack(realTrack)
if not dummyAnimator or mirrored[realTrack] then return end
local anim = realTrack.Animation
if not anim then return end
local info = { track = nil, mapped = false, lastWeight = realTrack.WeightTarget, lastSpeed = realTrack.Speed }
mirrored[realTrack] = info -- reserve the slot while it loads
task.spawn(function()
local id = animIdOf(anim)
local replacement = id and roleIdMap[id]
local track
-- try the other player's animation first; if it can't load, use yours
if replacement and not badAnimIds[replacement] then
track = loadCopyTrack("rbxassetid://" .. replacement)
if track then
local waited = 0
while track.Length == 0 and waited < 1.5 do
waited += task.wait()
end
if track.Length == 0 then
track = nil
badAnimIds[replacement] = true
end
else
badAnimIds[replacement] = true
end
info.mapped = track ~= nil
end
if not track then
track = loadCopyTrack(anim.AnimationId)
end
if not track or mirrored[realTrack] ~= info then return end
info.track = track
track.Priority = realTrack.Priority
track.Looped = realTrack.Looped
track:Play(0.1, math.max(realTrack.WeightTarget, 0.01), realTrack.Speed)
if not info.mapped then track.TimePosition = realTrack.TimePosition end
end)
end
-- put the finished model in the world and make it copy your character
local function installDummy(model)
local char = player.Character
local hum = getHumanoid()
if not char or not hum or not getRoot() then
model:Destroy()
error("no character")
end
removeDummy()
dummy = model
dummy.Name = "TrollHubCopy"
-- keep the Humanoid (it is what draws clothes), just make it quiet
local dummyHum = dummy:FindFirstChildOfClass("Humanoid")
if dummyHum then
dummyHum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
dummyHum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
dummyHum.RequiresNeck = false
pcall(function() dummyHum.EvaluateStateMachine = false end)
dummyAnimator = dummyHum:FindFirstChildOfClass("Animator")
if not dummyAnimator then
dummyAnimator = Instance.new("Animator")
dummyAnimator.Parent = dummyHum
end
end
local myHead = char:FindFirstChild("Head")
for _, d in ipairs(dummy:GetDescendants()) do
if d:IsA("BasePart") then
d.CanCollide = false
d.CanQuery = false
d.CanTouch = false
d.Massless = true
table.insert(dummyParts, d)
-- follow the fade your camera applies to your own parts (first person etc.)
local source = char:FindFirstChild(d.Name)
if not (source and source:IsA("BasePart")) then
source = d.Parent:IsA("Accessory") and myHead or nil
end
if source then table.insert(transparencyPairs, { d, source }) end
end
end
local droot = dummy:FindFirstChild("HumanoidRootPart")
if droot then droot.Anchored = true end
dummy.Parent = workspace
-- when turning into someone: your animation slots -> their animation slots.
-- The model Roblox built for them has their animations ready in its Animate
-- script; if not, fall back to the ids in their avatar description.
roleIdMap = {}
local swapped = 0
local function collectIds(folder)
local ids = {}
for _, c in ipairs(folder:GetChildren()) do
if c:IsA("Animation") then
local id = animIdOf(c)
if id then table.insert(ids, id) end
end
end
return ids
end
local animate = char:FindFirstChild("Animate")
if becomeDescription and animate then
local theirs = dummy:FindFirstChild("Animate")
for folderName, prop in pairs(ROLE_PROPS) do
local ours = animate:FindFirstChild(folderName)
if ours then
local targetIds = {}
local theirFolder = theirs and theirs:FindFirstChild(folderName)
if theirFolder then targetIds = collectIds(theirFolder) end
if #targetIds == 0 then
local fromDesc = becomeDescription[prop]
if fromDesc and fromDesc ~= 0 then targetIds = { tostring(fromDesc) } end
end
if #targetIds > 0 then
for i, id in ipairs(collectIds(ours)) do
roleIdMap[id] = targetIds[(i - 1) % #targetIds + 1]
swapped += 1
end
end
end
end
end
hideMyCharacter()
-- copy every animation your real character plays (including emotes)
local realAnimator = hum:FindFirstChildOfClass("Animator")
if realAnimator then
animConn = realAnimator.AnimationPlayed:Connect(mirrorTrack)
for _, track in ipairs(realAnimator:GetPlayingAnimationTracks()) do
mirrorTrack(track)
end
end
local lastScan = 0
mirrorConn = RunService.RenderStepped:Connect(function()
local root = getRoot()
if root and droot and droot.Parent then droot.CFrame = root.CFrame end
-- pick up any playing track we missed
if realAnimator and os.clock() - lastScan > 0.25 then
lastScan = os.clock()
for _, t in ipairs(realAnimator:GetPlayingAnimationTracks()) do
if not mirrored[t] then mirrorTrack(t) end
end
end
for realTrack, info in pairs(mirrored) do
local track = info.track
if track then
if not realTrack.IsPlaying then
mirrored[realTrack] = nil
pcall(function() track:Stop(0.1) end)
else
-- only touch weight/speed when they actually changed (no constant re-fading)
local w = realTrack.WeightTarget
if math.abs(w - info.lastWeight) > 0.02 then
info.lastWeight = w
track:AdjustWeight(math.max(w, 0.01), 0.1)
end
local sp = realTrack.Speed
if math.abs(sp - info.lastSpeed) > 0.02 then
info.lastSpeed = sp
track:AdjustSpeed(sp)
end
end
end
end
for _, pair in ipairs(transparencyPairs) do
if pair[1].Parent and pair[2].Parent then
pair[1].LocalTransparencyModifier = pair[2].LocalTransparencyModifier
end
end
end)
-- the copy's humanoid likes to turn collisions back on, so keep them off
collideConn = RunService.Stepped:Connect(function()
for _, part in ipairs(dummyParts) do
if part.Parent then part.CanCollide = false end
end
end)
return swapped
end
---------------------------------------------------------------
-- descriptions
---------------------------------------------------------------
local function applyScales(desc, hum)
for valueName, prop in pairs(SCALE_MAP) do
local v = hum:FindFirstChild(valueName)
if v and v:IsA("NumberValue") then desc[prop] = v.Value end
end
end
local function getMyDescription(hum)
if myDescription then return myDescription end
local ok, d = pcall(function() return Players:GetHumanoidDescriptionFromUserId(player.UserId) end)
if not (ok and d) then
ok, d = pcall(function() return hum:GetAppliedDescription() end)
end
if ok and d then myDescription = d end
return myDescription
end
-- work out which accessory type an item id is by trying them (cached)
local function resolveAccessoryType(hum, id)
if accessoryTypeCache[id] then return accessoryTypeCache[id] end
for _, accType in ipairs(ACCESSORY_TYPES) do
local ok, found = pcall(function()
local desc = Instance.new("HumanoidDescription")
desc:SetAccessories({ { AssetId = id, AccessoryType = accType, IsLayered = false } }, true)
local model = Players:CreateHumanoidModelFromDescription(desc, hum.RigType)
local has = model:FindFirstChildOfClass("Accessory") ~= nil
model:Destroy()
return has
end)
if ok and found then
accessoryTypeCache[id] = accType
return accType
end
end
return nil
end
local function anythingActive()
return larp.headless or larp.korblox or next(larp.toggled) ~= nil or #customItems > 0 or becomeDescription ~= nil
end
local function applyLarp()
if applying then
pending = true
return
end
applying = true
repeat
pending = false
local hum = getHumanoid()
if hum then
if not anythingActive() then
removeDummy()
setStatus("back to normal")
else
local warning, swapped
local ok, err = pcall(function()
local source = becomeDescription or getMyDescription(hum)
if not source then error("couldn't read your avatar") end
local desc = source:Clone()
applyScales(desc, hum)
if larp.headless then desc.Head = HEADLESS_ID end
if larp.korblox then desc.RightLeg = KORBLOX_ID end
local ids = {}
for id in pairs(larp.toggled) do table.insert(ids, id) end
for _, id in ipairs(customItems) do table.insert(ids, id) end
local list = desc:GetAccessories(true)
for _, id in ipairs(ids) do
local accType = resolveAccessoryType(hum, id)
if accType then
table.insert(list, { AssetId = id, AccessoryType = accType, IsLayered = false })
else
warning = "couldn't load item " .. id
end
end
desc:SetAccessories(list, true)
swapped = installDummy(Players:CreateHumanoidModelFromDescription(desc, hum.RigType))
end)
if not ok then
setStatus("failed: " .. tostring(err):sub(1, 80))
else
local message = "applied!"
if becomeDescription and swapped then message = "applied! (" .. swapped .. " animations swapped)" end
setStatus(warning or message)
end
end
end
until not pending
applying = false
end
-- keep your look after respawning
player.CharacterAdded:Connect(function()
removeDummy()
if anythingActive() then
task.wait(1.5)
task.spawn(applyLarp)
end
end)
---------------------------------------------------------------
-- UI
---------------------------------------------------------------
local setters = {}
setters.headless = makeToggle("Headless", UDim2.fromOffset(22, rowY(0)), function(on)
larp.headless = on
task.spawn(applyLarp)
end, content, half)
setters.korblox = makeToggle("Korblox", UDim2.fromOffset(266, rowY(0)), function(on)
larp.korblox = on
task.spawn(applyLarp)
end, content, half)
local itemSetters = {}
for i, item in ipairs(LARP_ITEMS) do
local col = (i - 1) % 2
local row = 1 + math.floor((i - 1) / 2)
itemSetters[i] = makeToggle(item.name, UDim2.fromOffset(col == 0 and 22 or 266, rowY(row)), function(on)
larp.toggled[item.id] = on or nil
task.spawn(applyLarp)
end, content, half)
end
local nextRow = 1 + math.ceil(#LARP_ITEMS / 2)
-- the emote buttons (filled in when you turn into someone) + scroll padding
local emoteHeading = Instance.new("TextLabel")
emoteHeading.Name = "LarpEmoteHeading"
emoteHeading.Size = UDim2.fromOffset(436, 24)
emoteHeading.BackgroundTransparency = 1
emoteHeading.Text = "Their emotes (press to play)"
emoteHeading.Font = theme.font
emoteHeading.TextScaled = true
emoteHeading.TextColor3 = theme.textColor
emoteHeading:SetAttribute("ThemeText", true)
emoteHeading.Visible = false
emoteHeading.ZIndex = 3
emoteHeading.Parent = content
local pad = Instance.new("Frame")
pad.BackgroundTransparency = 1
pad.Size = UDim2.fromOffset(10, 10)
pad.Parent = content
local emoteButtons = {}
local function playEmote(name, ids)
local hum = getHumanoid()
if not hum then return end
for _, id in ipairs(ids) do
local ok, success = pcall(function() return hum:PlayEmoteAndGetAnimTrackById(id) end)
if ok and success then return end
end
if not pcall(function() hum:PlayEmote(name) end) then
setStatus("couldn't play that emote")
end
end
local function rebuildEmotes()
for _, b in ipairs(emoteButtons) do b:Destroy() end
emoteButtons = {}
local emotes = {}
if becomeDescription then
local ok, result = pcall(function() return becomeDescription:GetEmotes() end)
if ok and type(result) == "table" then emotes = result end
end
local names = {}
for name in pairs(emotes) do table.insert(names, name) end
table.sort(names)
local startRow = nextRow + 3
emoteHeading.Visible = #names > 0
emoteHeading.Position = UDim2.fromOffset(22, rowY(startRow))
for i, name in ipairs(names) do
local col = (i - 1) % 2
local row = startRow + 1 + math.floor((i - 1) / 2)
local b = ui.studButton(content, name, UDim2.fromOffset(col == 0 and 22 or 266, rowY(row)), half, theme.enabledColor, "LarpEmote" .. i)
local ids = emotes[name]
b.MouseButton1Click:Connect(function() playEmote(name, ids) end)
table.insert(emoteButtons, b)
end
pad.Position = UDim2.fromOffset(0, rowY(startRow + 2 + math.ceil(#names / 2)))
end
rebuildEmotes()
-- wear any catalog item by typing its id
local idBox = ui.input(content, "LarpItemId", "Item id (from the catalog URL)", UDim2.fromOffset(22, rowY(nextRow)), half)
local wearBtn = ui.studButton(content, "add item", UDim2.fromOffset(266, rowY(nextRow)), half, theme.enabledColor, "LarpWearBtn")
wearBtn.MouseButton1Click:Connect(function()
local id = tonumber(idBox.Text:match("%d+") or "")
if not id then
setStatus("type an item id first")
return
end
if not table.find(customItems, id) then table.insert(customItems, id) end
idBox.Text = ""
setStatus("adding item " .. id .. "...")
task.spawn(applyLarp)
end)
local clearBtn = ui.studButton(content, "remove typed", UDim2.fromOffset(22, rowY(nextRow + 1)), half, theme.enabledColor, "LarpClearBtn")
clearBtn.MouseButton1Click:Connect(function()
customItems = {}
task.spawn(applyLarp)
end)
local restoreBtn = ui.studButton(content, "restore me", UDim2.fromOffset(266, rowY(nextRow + 1)), half, theme.enabledColor, "LarpRestoreBtn")
restoreBtn.MouseButton1Click:Connect(function()
larp.headless, larp.korblox = false, false
larp.toggled = {}
customItems = {}
becomeDescription = nil
setters.headless(false)
setters.korblox(false)
for _, setVisual in ipairs(itemSetters) do setVisual(false) end
rebuildEmotes()
task.spawn(applyLarp)
end)
-- turn into any Roblox user (they don't have to be in your server)
local userBox = ui.input(content, "LarpUser", "Username (anyone on Roblox)", UDim2.fromOffset(22, rowY(nextRow + 2)), half)
local becomeBtn = ui.studButton(content, "turn into them", UDim2.fromOffset(266, rowY(nextRow + 2)), half, theme.enabledColor, "LarpBecomeBtn")
becomeBtn.MouseButton1Click:Connect(function()
local name = userBox.Text:gsub("%s", "")
if name == "" then
setStatus("type a username first")
return
end
setStatus("loading " .. name .. "...")
task.spawn(function()
local okId, userId = pcall(function() return Players:GetUserIdFromNameAsync(name) end)
if not okId or not userId then
setStatus("couldn't find that user")
return
end
local okDesc, desc = pcall(function() return Players:GetHumanoidDescriptionFromUserId(userId) end)
if not okDesc or not desc then
setStatus("couldn't load that avatar: " .. tostring(desc):sub(1, 60))
return
end
becomeDescription = desc
rebuildEmotes()
applyLarp()
end)
end)
end
---------------------------------------------------------------------
-- Media tab: play music from an audio id, and retexture things with a decal
-- (everything here is local: only you hear / see it)
---------------------------------------------------------------------
do
local SoundService = game:GetService("SoundService")
local MarketplaceService = game:GetService("MarketplaceService")
local ContentProvider = game:GetService("ContentProvider")
local Lighting = game:GetService("Lighting")
local page = ui.page("Media")
makeTab("Media", 7)
tabs.Media.MouseButton1Click:Connect(function() setTab("Media") end)
local subtitle = ui.subtitle(page, "music & textures")
local statusToken = 0
local function setStatus(text)
statusToken += 1
local mine = statusToken
subtitle.Text = text
task.delay(4, function()
if statusToken == mine then subtitle.Text = "music & textures" end
end)
end
local content = ui.scroller(page, "MediaContent", UDim2.fromOffset(0, 98), UDim2.new(1, 0, 1, -104))
local half = UDim2.fromOffset(192, 52)
local function rowY(r) return 4 + r * 58 end
local LEFT, RIGHT = 22, 266
local function heading(text, row)
local l = Instance.new("TextLabel")
l.Size = UDim2.fromOffset(436, 26)
l.Position = UDim2.fromOffset(LEFT, rowY(row))
l.BackgroundTransparency = 1
l.Text = text
l.Font = theme.font
l.TextScaled = true
l.TextColor3 = theme.textColor
l:SetAttribute("ThemeText", true)
l.ZIndex = 3
l.Parent = content
end
---------------------------------------------------------------
-- music
---------------------------------------------------------------
heading("Music", 0)
local sound = Instance.new("Sound")
sound.Name = "TrollHubMusic"
sound.Volume = 1
sound.Parent = SoundService
local pauseLabel
local audioBox = ui.input(content, "MediaAudioId", "Audio id (music id)", UDim2.fromOffset(LEFT, rowY(1)), half)
local playBtn = ui.studButton(content, "play", UDim2.fromOffset(RIGHT, rowY(1)), half, theme.enabledColor, "MediaPlayBtn")
local stopBtn = ui.studButton(content, "stop", UDim2.fromOffset(LEFT, rowY(2)), half, theme.enabledColor, "MediaStopBtn")
local pauseBtn
pauseBtn, pauseLabel = ui.studButton(content, "pause", UDim2.fromOffset(RIGHT, rowY(2)), half, theme.enabledColor, "MediaPauseBtn")
playBtn.MouseButton1Click:Connect(function()
local id = audioBox.Text:match("%d+")
if not id then
setStatus("type an audio id first")
return
end
setStatus("loading audio...")
task.spawn(function()
sound:Stop()
sound.SoundId = "rbxassetid://" .. id
local waited = 0
while not sound.IsLoaded and waited < 5 do
waited += task.wait(0.1)
end
if not sound.IsLoaded then
setStatus("couldn't load that audio (it may be private)")
return
end
sound.TimePosition = 0
sound:Play()
pauseLabel.Text = "pause"
setStatus("playing " .. id)
end)
end)
stopBtn.MouseButton1Click:Connect(function()
sound:Stop()
pauseLabel.Text = "pause"
end)
pauseBtn.MouseButton1Click:Connect(function()
if sound.IsPlaying then
sound:Pause()
pauseLabel.Text = "resume"
elseif sound.IsPaused then
sound:Resume()
pauseLabel.Text = "pause"
end
end)
sound.Ended:Connect(function() pauseLabel.Text = "pause" end)
local volumeBox = ui.input(content, "MediaVolume", "Volume (1)", UDim2.fromOffset(LEFT, rowY(3)), half)
volumeBox.FocusLost:Connect(function()
local n = tonumber(volumeBox.Text)
if volumeBox.Text:gsub("%s", "") == "" then
sound.Volume = 1
elseif n then
sound.Volume = math.clamp(n, 0, 10)
else
ui.flashInvalid(volumeBox, "type a number")
end
end)
local speedBox = ui.input(content, "MediaSpeed", "Speed (1)", UDim2.fromOffset(RIGHT, rowY(3)), half)
speedBox.FocusLost:Connect(function()
local n = tonumber(speedBox.Text)
if speedBox.Text:gsub("%s", "") == "" then
sound.PlaybackSpeed = 1
elseif n then
sound.PlaybackSpeed = math.clamp(n, 0.1, 5)
else
ui.flashInvalid(speedBox, "type a number")
end
end)
makeToggle("Loop", UDim2.fromOffset(LEFT, rowY(4)), function(on) sound.Looped = on end, content, half)
local reverb
makeToggle("Reverb", UDim2.fromOffset(RIGHT, rowY(4)), function(on)
if on then
reverb = Instance.new("ReverbSoundEffect")
reverb.DecayTime = 4
reverb.Density = 1
reverb.Diffusion = 1
reverb.DryLevel = -6
reverb.WetLevel = 0
reverb.Parent = sound
elseif reverb then
reverb:Destroy()
reverb = nil
end
end, content, half)
local bass
makeToggle("Bass boost", UDim2.fromOffset(LEFT, rowY(5)), function(on)
if on then
bass = Instance.new("EqualizerSoundEffect")
bass.LowGain = 8
bass.MidGain = -2
bass.HighGain = 0
bass.Parent = sound
elseif bass then
bass:Destroy()
bass = nil
end
end, content, half)
---------------------------------------------------------------
-- textures
---------------------------------------------------------------
heading("Textures (decal id)", 6)
-- does this image url actually load?
local function loads(url)
local img = Instance.new("ImageLabel")
img.Image = url
pcall(function() ContentProvider:PreloadAsync({ img }) end)
local ok, status = pcall(function() return ContentProvider:GetAssetFetchStatus(url) end)
img:Destroy()
return ok and status == Enum.AssetFetchStatus.Success
end
-- A decal id is not the picture itself. Find the real image id next to it
-- (it has the same name and creator), otherwise try the decal id directly,
-- otherwise ask Roblox for a thumbnail of the asset.
local urlCache = {}
local function findWorkingUrl(id)
if urlCache[id] then return urlCache[id][1], urlCache[id][2] end
local candidates = {}
local okInfo, info = pcall(function() return MarketplaceService:GetProductInfo(id, Enum.InfoType.Asset) end)
if okInfo and info and info.AssetTypeId == 13 then
for _, nearby in ipairs({ id - 1, id + 1, id - 2, id + 2 }) do
local ok2, info2 = pcall(function() return MarketplaceService:GetProductInfo(nearby, Enum.InfoType.Asset) end)
if ok2 and info2 and info2.AssetTypeId == 1 and info2.Name == info.Name
and info2.Creator and info.Creator and info2.Creator.Id == info.Creator.Id then
table.insert(candidates, "rbxassetid://" .. nearby)
break
end
end
end
table.insert(candidates, "rbxassetid://" .. id)
table.insert(candidates, "rbxthumb://type=Asset&id=" .. id .. "&w=420&h=420")
for _, url in ipairs(candidates) do
if loads(url) then
urlCache[id] = { url, true }
return url, true
end
end
return candidates[1], false -- nothing confirmed: use the best guess
end
shared.findWorkingUrl = findWorkingUrl
-- returns the url to use, and whether it was confirmed to load
local function urlFromBox(box)
local id = tonumber(box.Text:match("%d+") or "")
if not id then
setStatus("type a decal id first")
return nil
end
setStatus("loading image...")
return findWorkingUrl(id)
end
local function finish(text, confirmed)
setStatus(confirmed and text or (text .. " (image may not load)"))
end
local texBox = ui.input(content, "MediaTexture", "Decal id (texture)", UDim2.fromOffset(LEFT, rowY(7)), half)
local made = {} -- every decal we create, so "reset" can remove them
local FACES = Enum.NormalId:GetEnumItems()
local function applyTexture(part, url)
for _, face in ipairs(FACES) do
local d = Instance.new("Decal")
d.Name = "TrollHubTexture"
d.Face = face
d.Texture = url
d.Parent = part
table.insert(made, d)
end
end
-- click any part to retexture it
local clickMode = false
UserInputService.InputBegan:Connect(function(input, processed)
if not clickMode or processed then return end
if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
local cam = workspace.CurrentCamera
local ray = cam:ScreenPointToRay(input.Position.X, input.Position.Y)
local result = workspace:Raycast(ray.Origin, ray.Direction * 2000)
local hit = result and result.Instance
if hit and hit:IsA("BasePart") and not hit:IsA("Terrain") then
task.spawn(function()
local url, ok = urlFromBox(texBox)
if not url then return end
applyTexture(hit, url)
finish("textured " .. hit.Name, ok)
end)
end
end)
makeToggle("Click to texture", UDim2.fromOffset(RIGHT, rowY(7)), function(on) clickMode = on end, content, half)
local charBtn = ui.studButton(content, "texture me", UDim2.fromOffset(LEFT, rowY(8)), half, theme.enabledColor, "MediaCharBtn")
charBtn.MouseButton1Click:Connect(function()
task.spawn(function()
local url, ok = urlFromBox(texBox)
local char = player.Character
if not url or not char then return end
for _, d in ipairs(char:GetDescendants()) do
if d:IsA("BasePart") then applyTexture(d, url) end
end
finish("textured your character", ok)
end)
end)
local nearbyBtn = ui.studButton(content, "texture nearby", UDim2.fromOffset(RIGHT, rowY(8)), half, theme.enabledColor, "MediaNearbyBtn")
nearbyBtn.MouseButton1Click:Connect(function()
task.spawn(function()
local url, ok = urlFromBox(texBox)
local root = getRoot()
if not url or not root then return end
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = { player.Character }
local count = 0
for _, part in ipairs(workspace:GetPartBoundsInRadius(root.Position, 100, params)) do
if count >= 400 then break end
local inCharacter = false
local inst = part.Parent
while inst and inst ~= workspace do
if inst:FindFirstChildOfClass("Humanoid") then inCharacter = true break end
inst = inst.Parent
end
if not inCharacter then
applyTexture(part, url)
count += 1
end
end
finish("textured " .. count .. " parts", ok)
end)
end)
-- texture every part in the whole map (spread over several frames so it doesn't freeze)
local MAX_ALL = 2000
local allBusy = false
local allBtn = ui.studButton(content, "texture all", UDim2.fromOffset(LEFT, rowY(9)), half, theme.enabledColor, "MediaAllBtn")
allBtn.MouseButton1Click:Connect(function()
if allBusy then return end
allBusy = true
task.spawn(function()
local url, ok = urlFromBox(texBox)
if url then
local count = 0
for _, part in ipairs(workspace:GetDescendants()) do
if count >= MAX_ALL then break end
if part:IsA("BasePart") and not part:IsA("Terrain") and not part:FindFirstChild("TrollHubTexture") then
local inCharacter = false
local inst = part.Parent
while inst and inst ~= workspace do
if inst:FindFirstChildOfClass("Humanoid") then inCharacter = true break end
inst = inst.Parent
end
if not inCharacter then
applyTexture(part, url)
count += 1
if count % 40 == 0 then
setStatus("texturing... " .. count)
task.wait()
end
end
end
end
finish("textured " .. count .. " parts", ok)
end
allBusy = false
end)
end)
local resetBtn = ui.studButton(content, "reset textures", UDim2.fromOffset(RIGHT, rowY(9)), half, theme.enabledColor, "MediaResetBtn")
resetBtn.MouseButton1Click:Connect(function()
for _, d in ipairs(made) do
if d.Parent then d:Destroy() end
end
made = {}
setStatus("textures removed")
end)
-- the picture covering your screen (behind this menu)
local screenImage
local setScreenVisual
setScreenVisual = makeToggle("Screen image", UDim2.fromOffset(LEFT, rowY(10)), function(on)
if screenImage then
screenImage:Destroy()
screenImage = nil
end
if not on then return end
task.spawn(function()
local url = urlFromBox(texBox)
if not url then
setScreenVisual(false)
return
end
screenImage = Instance.new("ImageLabel")
screenImage.Name = "TrollHubScreenImage"
screenImage.Size = UDim2.fromScale(1, 1)
screenImage.BackgroundTransparency = 1
screenImage.Image = url
screenImage.ImageTransparency = 0.35
screenImage.ScaleType = Enum.ScaleType.Fit
screenImage.ZIndex = 0
screenImage.Parent = screenGui
end)
end, content, half)
-- sky
local skyBox = ui.input(content, "MediaSky", "Sky decal id", UDim2.fromOffset(LEFT, rowY(11)), half)
local skyMine, skyBackup
local skyBtn = ui.studButton(content, "apply sky", UDim2.fromOffset(RIGHT, rowY(11)), half, theme.enabledColor, "MediaSkyBtn")
skyBtn.MouseButton1Click:Connect(function()
task.spawn(function()
local url, ok = urlFromBox(skyBox)
if not url then return end
if not skyBackup then
skyBackup = {}
for _, c in ipairs(Lighting:GetChildren()) do
if c:IsA("Sky") then
c.Parent = nil
table.insert(skyBackup, c)
end
end
end
if skyMine then skyMine:Destroy() end
skyMine = Instance.new("Sky")
skyMine.Name = "TrollHubSky"
for _, prop in ipairs({ "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }) do
skyMine[prop] = url
end
skyMine.Parent = Lighting
finish("sky changed", ok)
end)
end)
local skyResetBtn = ui.studButton(content, "reset sky", UDim2.fromOffset(LEFT, rowY(12)), half, theme.enabledColor, "MediaSkyResetBtn")
skyResetBtn.MouseButton1Click:Connect(function()
if skyMine then
skyMine:Destroy()
skyMine = nil
end
if skyBackup then
for _, c in ipairs(skyBackup) do c.Parent = Lighting end
skyBackup = nil
end
setStatus("sky restored")
end)
local pad = Instance.new("Frame")
pad.BackgroundTransparency = 1
pad.Size = UDim2.fromOffset(10, 10)
pad.Position = UDim2.fromOffset(0, rowY(13))
pad.Parent = content
end
---------------------------------------------------------------------
-- Camera tab: infinite zoom, freecam, field of view, tilt, orbit, screenshot mode
-- (all of this only changes your own view)
---------------------------------------------------------------------
do
local ContextActionService = game:GetService("ContextActionService")
local page = ui.page("Camera")
makeTab("Camera", 8)
tabs.Camera.MouseButton1Click:Connect(function() setTab("Camera") end)
local subtitle = ui.subtitle(page, "camera tools")
local statusToken = 0
local function setStatus(text, seconds)
statusToken += 1
local mine = statusToken
subtitle.Text = text
task.delay(seconds or 4, function()
if statusToken == mine then subtitle.Text = "camera tools" end
end)
end
local content = ui.scroller(page, "CameraContent", UDim2.fromOffset(0, 98), UDim2.new(1, 0, 1, -104))
local half = UDim2.fromOffset(192, 52)
local function rowY(r) return 4 + r * 58 end
local LEFT, RIGHT = 22, 266
-- small helper: a number box that calls onValue(number or nil for empty)
local function numberBox(name, placeholder, position, onValue)
local box = ui.input(content, name, placeholder, position, half)
box.FocusLost:Connect(function()
if box.Text:gsub("%s", "") == "" then
onValue(nil)
else
local n = tonumber(box.Text)
if n then
onValue(n)
else
ui.flashInvalid(box, "type a number")
end
end
end)
return box
end
---------------------------------------------------------------
-- zoom
---------------------------------------------------------------
local originalMax = player.CameraMaxZoomDistance
local originalMin = player.CameraMinZoomDistance
local infiniteZoom = false
makeToggle("Infinite zoom", UDim2.fromOffset(LEFT, rowY(0)), function(on)
infiniteZoom = on
player.CameraMaxZoomDistance = on and 1e6 or originalMax
setStatus(on and "zoom out as far as you want" or "zoom limit restored")
end, content, half)
numberBox("CamZoomDistance", "Zoom distance (studs)", UDim2.fromOffset(RIGHT, rowY(0)), function(n)
if n then
n = math.clamp(n, 0.5, 1e6)
if player.CameraMaxZoomDistance < n then player.CameraMaxZoomDistance = n end
player.CameraMinZoomDistance = n
player.CameraMaxZoomDistance = n -- lock the zoom at exactly this distance
setStatus("zoom locked at " .. n .. " (clear the box to unlock)")
else
player.CameraMinZoomDistance = originalMin
player.CameraMaxZoomDistance = infiniteZoom and 1e6 or originalMax
setStatus("zoom unlocked")
end
end)
---------------------------------------------------------------
-- freecam + camera effects (all in one step that runs after the normal camera)
---------------------------------------------------------------
local freecam, looking = false, false
local fcPos, fcYaw, fcPitch = Vector3.zero, 0, 0
local fcSpeed = 40
local roll = 0
local orbitOn, orbitAngle, orbitSpeed = false, 0, 0.5
local FREECAM_KEYS = {
Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D,
Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right,
Enum.KeyCode.Space, Enum.KeyCode.E, Enum.KeyCode.Q,
Enum.KeyCode.LeftShift, Enum.KeyCode.LeftControl,
}
local function startFreecam()
local cam = workspace.CurrentCamera
freecam = true
fcPos = cam.CFrame.Position
fcPitch, fcYaw = cam.CFrame:ToOrientation()
cam.CameraType = Enum.CameraType.Scriptable
-- keep your character from walking around while the keys move the camera
ContextActionService:BindActionAtPriority("TrollHubFreecam", function()
return Enum.ContextActionResult.Sink
end, false, Enum.ContextActionPriority.High.Value, unpack(FREECAM_KEYS))
setStatus("freecam: WASD move, E/Q up/down, hold right mouse to look, Shift fast, wheel = speed", 7)
end
local function stopFreecam()
freecam, looking = false, false
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
ContextActionService:UnbindAction("TrollHubFreecam")
local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Custom
local hum = getHumanoid()
if hum then cam.CameraSubject = hum end
end
RunService:BindToRenderStep("TrollHubCamera", Enum.RenderPriority.Camera.Value + 1, function(dt)
local cam = workspace.CurrentCamera
if not cam then return end
if freecam then
local move = Vector3.zero
if not UserInputService:GetFocusedTextBox() then
local function down(k) return UserInputService:IsKeyDown(k) end
if down(Enum.KeyCode.W) or down(Enum.KeyCode.Up) then move += Vector3.new(0, 0, -1) end
if down(Enum.KeyCode.S) or down(Enum.KeyCode.Down) then move += Vector3.new(0, 0, 1) end
if down(Enum.KeyCode.A) or down(Enum.KeyCode.Left) then move += Vector3.new(-1, 0, 0) end
if down(Enum.KeyCode.D) or down(Enum.KeyCode.Right) then move += Vector3.new(1, 0, 0) end
if down(Enum.KeyCode.E) or down(Enum.KeyCode.Space) then move += Vector3.new(0, 1, 0) end
if down(Enum.KeyCode.Q) then move += Vector3.new(0, -1, 0) end
end
local speed = fcSpeed
if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
speed *= 3
elseif UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then
speed *= 0.25
end
local rot = CFrame.fromOrientation(fcPitch, fcYaw, 0)
local worldMove = rot:VectorToWorldSpace(Vector3.new(move.X, 0, move.Z)) + Vector3.new(0, move.Y, 0)
fcPos += worldMove * speed * dt
cam.CFrame = CFrame.new(fcPos) * rot
elseif orbitOn then
local root = getRoot()
if root then
orbitAngle += dt * orbitSpeed
local offset = cam.CFrame.Position - root.Position
local rotated = CFrame.Angles(0, orbitAngle, 0):VectorToWorldSpace(offset)
cam.CFrame = CFrame.lookAt(root.Position + rotated, root.Position)
end
end
if roll ~= 0 then
cam.CFrame = cam.CFrame * CFrame.Angles(0, 0, math.rad(roll))
end
end)
-- mouse look (hold right mouse) and speed wheel for the freecam
UserInputService.InputBegan:Connect(function(input)
if freecam and input.UserInputType == Enum.UserInputType.MouseButton2 then
looking = true
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
looking = false
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end)
UserInputService.InputChanged:Connect(function(input)
if not freecam then return end
if input.UserInputType == Enum.UserInputType.MouseMovement and looking then
fcYaw -= input.Delta.X * 0.004
fcPitch = math.clamp(fcPitch - input.Delta.Y * 0.004, -1.5, 1.5)
elseif input.UserInputType == Enum.UserInputType.MouseWheel then
fcSpeed = math.clamp(fcSpeed * (1 + 0.15 * input.Position.Z), 2, 2000)
end
end)
makeToggle("Freecam", UDim2.fromOffset(LEFT, rowY(1)), function(on)
if on then startFreecam() else stopFreecam() end
end, content, half)
numberBox("CamFreecamSpeed", "Freecam speed (40)", UDim2.fromOffset(RIGHT, rowY(1)), function(n)
fcSpeed = n and math.clamp(n, 1, 2000) or 40
end)
numberBox("CamFov", "Field of view (70)", UDim2.fromOffset(LEFT, rowY(2)), function(n)
workspace.CurrentCamera.FieldOfView = n and math.clamp(n, 1, 120) or 70
end)
numberBox("CamTilt", "Tilt in degrees (0)", UDim2.fromOffset(RIGHT, rowY(2)), function(n)
roll = n and math.clamp(n, -180, 180) or 0
end)
makeToggle("Orbit view", UDim2.fromOffset(LEFT, rowY(3)), function(on) orbitOn = on end, content, half)
numberBox("CamOrbitSpeed", "Orbit speed (0.5)", UDim2.fromOffset(RIGHT, rowY(3)), function(n)
orbitSpeed = n and math.clamp(n, -10, 10) or 0.5
end)
---------------------------------------------------------------
-- screenshot mode: hides this menu, Roblox's own UI and name tags for a few seconds
---------------------------------------------------------------
local shotSeconds = 6
local shotBusy = false
local shotBtn = ui.studButton(content, "screenshot mode", UDim2.fromOffset(LEFT, rowY(4)), half, theme.enabledColor, "CamShotBtn")
shotBtn.MouseButton1Click:Connect(function()
if shotBusy then return end
shotBusy = true
task.spawn(function()
local frameWas, miniWas = frame.Visible, miniBtn.Visible
local savedTags = {}
for _, plr in ipairs(Players:GetPlayers()) do
local hum = plr.Character and plr.Character:FindFirstChildOfClass("Humanoid")
if hum then
savedTags[hum] = hum.DisplayDistanceType
hum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end
end
sidebar.Visible = false
frame.Visible = false
miniBtn.Visible = false
pcall(function() StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) end)
task.wait(shotSeconds)
frame.Visible = frameWas
miniBtn.Visible = miniWas
pcall(function() StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true) end)
for hum, tag in pairs(savedTags) do
if hum.Parent then hum.DisplayDistanceType = tag end
end
shotBusy = false
end)
end)
numberBox("CamShotSeconds", "Hide for seconds (6)", UDim2.fromOffset(RIGHT, rowY(4)), function(n)
shotSeconds = n and math.clamp(n, 1, 60) or 6
end)
local pad = Instance.new("Frame")
pad.BackgroundTransparency = 1
pad.Size = UDim2.fromOffset(10, 10)
pad.Position = UDim2.fromOffset(0, rowY(5))
pad.Parent = content
end
---------------------------------------------------------------------
-- Destruction tab: part editor, fire / neon storm, JOHN DOE, player billboards
-- (everything is local to your screen. Unanchored parts you have control of,
-- and your own character's movement, can still be seen moving by others.)
---------------------------------------------------------------------
do
local page = ui.page("Destruction")
makeTab("Destruction", 9)
tabs.Destruction.MouseButton1Click:Connect(function() setTab("Destruction") end)
local subtitle = ui.subtitle(page, "destruction")
-- shared helpers for the sections below
local D = {}
D.LEFT, D.RIGHT = 22, 266
D.half = UDim2.fromOffset(192, 52)
function D.rowY(r) return 4 + r * 58 end
local statusToken = 0
function D.setStatus(text, seconds)
statusToken += 1
local mine = statusToken
subtitle.Text = text
task.delay(seconds or 4, function()
if statusToken == mine then subtitle.Text = "destruction" end
end)
end
D.content = ui.scroller(page, "DestructionContent", UDim2.fromOffset(0, 98), UDim2.new(1, 0, 1, -104))
function D.heading(text, row)
local l = Instance.new("TextLabel")
l.Size = UDim2.fromOffset(436, 26)
l.Position = UDim2.fromOffset(D.LEFT, D.rowY(row))
l.BackgroundTransparency = 1
l.Text = text
l.Font = theme.font
l.TextScaled = true
l.TextColor3 = theme.textColor
l:SetAttribute("ThemeText", true)
l.ZIndex = 3
l.Parent = D.content
end
-- a normal button that follows the "enabled color" setting
function D.button(text, col, row, name)
table.insert(ENABLED_NAMES, name)
return ui.studButton(D.content, text, UDim2.fromOffset(col, D.rowY(row)), D.half, theme.enabledColor, name)
end
function D.toggle(text, col, row, callback)
return makeToggle(text, UDim2.fromOffset(col, D.rowY(row)), callback, D.content, D.half)
end
function D.numberBox(name, placeholder, col, row, onValue)
local box = ui.input(D.content, name, placeholder, UDim2.fromOffset(col, D.rowY(row)), D.half)
box.FocusLost:Connect(function()
if box.Text:gsub("%s", "") == "" then
onValue(nil)
else
local n = tonumber(box.Text)
if n then onValue(n) else ui.flashInvalid(box, "type a number") end
end
end)
return box
end
function D.inCharacter(part)
local inst = part.Parent
while inst and inst ~= workspace do
if inst:FindFirstChildOfClass("Humanoid") then return true end
inst = inst.Parent
end
return false
end
function D.raycastFromInput(input)
local cam = workspace.CurrentCamera
local ray = cam:ScreenPointToRay(input.Position.X, input.Position.Y)
local result = workspace:Raycast(ray.Origin, ray.Direction * 3000)
return result and result.Instance
end
---------------------------------------------------------------
-- 1) part editor (an F3X-style move / scale tool; the real F3X can't be loaded from a LocalScript)
---------------------------------------------------------------
D.heading("Part editor (click a part, then edit it)", 0)
do
local selected, boxes, history = {}, {}, {}
local selectMode = false
local step = 1
local function pushHistory(undoFn)
table.insert(history, undoFn)
if #history > 30 then table.remove(history, 1) end
end
local function deselect(part)
selected[part] = nil
if boxes[part] then
boxes[part]:Destroy()
boxes[part] = nil
end
end
local function clearSelection()
for part in pairs(selected) do deselect(part) end
end
local function select(part)
if selected[part] then return end
selected[part] = true
local box = Instance.new("SelectionBox")
box.Adornee = part
box.Color3 = Color3.fromRGB(255, 60, 60)
box.LineThickness = 0.06
box.Parent = part
boxes[part] = box
end
local function selectedCount()
local n = 0
for part in pairs(selected) do
if part.Parent then n += 1 end
end
return n
end
local function forSelected(fn)
for part in pairs(selected) do
if part.Parent then fn(part) end
end
end
UserInputService.InputBegan:Connect(function(input, processed)
if not selectMode or processed then return end
if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
local hit = D.raycastFromInput(input)
if hit and hit:IsA("BasePart") and not hit:IsA("Terrain") and not D.inCharacter(hit) then
if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
if selected[hit] then deselect(hit) else select(hit) end
else
clearSelection()
select(hit)
end
D.setStatus(selectedCount() .. " part(s) selected (hold Shift to add more)")
end
end)
D.toggle("Select parts", D.LEFT, 1, function(on) selectMode = on end)
D.numberBox("DestStep", "Move step (1 stud)", D.RIGHT, 1, function(n)
step = n and math.clamp(n, 0.05, 1000) or 1
end)
local function move(direction)
local before = {}
forSelected(function(part)
before[part] = part.CFrame
part.CFrame = part.CFrame + direction * step
end)
pushHistory(function()
for part, cf in pairs(before) do
if part.Parent then part.CFrame = cf end
end
end)
end
local moves = {
{ "move X -", D.LEFT, 2, Vector3.new(-1, 0, 0) }, { "move X +", D.RIGHT, 2, Vector3.new(1, 0, 0) },
{ "move down", D.LEFT, 3, Vector3.new(0, -1, 0) }, { "move up", D.RIGHT, 3, Vector3.new(0, 1, 0) },
{ "move Z -", D.LEFT, 4, Vector3.new(0, 0, -1) }, { "move Z +", D.RIGHT, 4, Vector3.new(0, 0, 1) },
}
for i, m in ipairs(moves) do
local b = D.button(m[1], m[2], m[3], "DestMoveBtn" .. i)
b.MouseButton1Click:Connect(function() move(m[4]) end)
end
local factor = 1.5
D.numberBox("DestScaleFactor", "Scale factor (1.5)", D.LEFT, 5, function(n)
factor = n and math.clamp(n, 0.01, 1000) or 1.5
end)
local scaleBtn = D.button("scale", D.RIGHT, 5, "DestScaleBtn")
scaleBtn.MouseButton1Click:Connect(function()
local before = {}
forSelected(function(part)
before[part] = part.Size
part.Size = part.Size * factor
end)
pushHistory(function()
for part, size in pairs(before) do
if part.Parent then part.Size = size end
end
end)
end)
local sizeBox = ui.input(D.content, "DestSize", "Set size: x,y,z", UDim2.fromOffset(D.LEFT, D.rowY(6)), D.half)
local sizeBtn = D.button("set size", D.RIGHT, 6, "DestSizeBtn")
sizeBtn.MouseButton1Click:Connect(function()
local a, b, c = sizeBox.Text:match("^%s*([%d%.]+)%s*,%s*([%d%.]+)%s*,%s*([%d%.]+)%s*$")
if not a then
ui.flashInvalid(sizeBox, "type like 4,1,2")
return
end
local newSize = Vector3.new(math.max(tonumber(a), 0.05), math.max(tonumber(b), 0.05), math.max(tonumber(c), 0.05))
local before = {}
forSelected(function(part)
before[part] = part.Size
part.Size = newSize
end)
pushHistory(function()
for part, size in pairs(before) do
if part.Parent then part.Size = size end
end
end)
end)
D.toggle("Anchored", D.LEFT, 7, function(on)
local before = {}
forSelected(function(part)
before[part] = part.Anchored
part.Anchored = on
end)
pushHistory(function()
for part, was in pairs(before) do
if part.Parent then part.Anchored = was end
end
end)
end)
local deleteBtn = D.button("delete", D.RIGHT, 7, "DestDeleteBtn")
deleteBtn.MouseButton1Click:Connect(function()
local removed = {}
forSelected(function(part)
table.insert(removed, { part, part.Parent })
part.Parent = nil
end)
clearSelection()
pushHistory(function()
for _, entry in ipairs(removed) do entry[1].Parent = entry[2] end
end)
end)
local dupBtn = D.button("duplicate", D.LEFT, 8, "DestDupBtn")
dupBtn.MouseButton1Click:Connect(function()
local clones = {}
forSelected(function(part)
local c = part:Clone()
for _, child in ipairs(c:GetChildren()) do
if child:IsA("SelectionBox") then child:Destroy() end
end
c.CFrame = part.CFrame + Vector3.new(part.Size.X + 0.5, 0, 0)
c.Parent = part.Parent
table.insert(clones, c)
end)
clearSelection()
for _, c in ipairs(clones) do select(c) end
pushHistory(function()
for _, c in ipairs(clones) do deselect(c) c:Destroy() end
end)
end)
local undoBtn = D.button("undo", D.RIGHT, 8, "DestUndoBtn")
undoBtn.MouseButton1Click:Connect(function()
local undo = table.remove(history)
if undo then
undo()
else
D.setStatus("nothing to undo")
end
end)
local clearBtn = D.button("clear selection", D.LEFT, 9, "DestClearBtn")
clearBtn.MouseButton1Click:Connect(clearSelection)
end
---------------------------------------------------------------
-- 2) set everything on fire / neon storm
---------------------------------------------------------------
D.heading("Fire + neon storm (flashing colors and lights)", 10)
do
local MAX_PARTS, MAX_FIRES, MAX_LIGHTS = 1500, 400, 40
local RED, PINK = Color3.fromRGB(255, 0, 60), Color3.fromRGB(255, 105, 220)
local tracked, original, fires, lights = {}, {}, {}, {}
local fireOn, neonOn = false, false
local hackerOn = false -- green and black world
local glitchWorldOn = false -- pink/green/blue glitch world (JOHN DOE/HACKER style, but 3 colors)
local fireColors = nil -- nil = normal fire, or { color, secondaryColor }
local neonSpeed = 2 -- colour cycles per second (kept low and smooth on purpose)
local GLITCH_COLORS = { Color3.fromRGB(255, 0, 170), Color3.fromRGB(0, 255, 100), Color3.fromRGB(0, 150, 255) }
local GLITCH_STEP = 0.18 -- seconds per colour (capped, not a fast strobe)
local function ensureTracked()
if #tracked > 0 then return end
local checked = 0
for _, d in ipairs(workspace:GetDescendants()) do
if #tracked >= MAX_PARTS then break end
if d:IsA("BasePart") and not d:IsA("Terrain") and not D.inCharacter(d) then
table.insert(tracked, d)
original[d] = { d.Color, d.Material }
end
checked += 1
if checked % 300 == 0 then task.wait() end
end
end
-- the static look (neon colors are animated separately)
local function applyLook()
for i, part in ipairs(tracked) do
if part.Parent then
local o = original[part]
if neonOn then
part.Material = Enum.Material.Neon
elseif hackerOn then
local green = i % 2 == 0
part.Material = green and Enum.Material.Neon or o[2]
part.Color = green and Color3.fromRGB(0, 255, 60) or Color3.new(0, 0, 0)
elseif glitchWorldOn then
part.Material = Enum.Material.Neon
part.Color = GLITCH_COLORS[(i % 3) + 1]
else
part.Material = o[2]
part.Color = fireOn and Color3.new(0, 0, 0) or o[1]
end
end
end
end
local function removeFires()
for _, f in pairs(fires) do f:Destroy() end
fires = {}
end
local function removeLights()
for _, l in pairs(lights) do l:Destroy() end
lights = {}
end
local function addFires()
local n = 0
for _, part in ipairs(tracked) do
if n >= MAX_FIRES then break end
if part.Parent and not fires[part] then
local f = Instance.new("Fire")
f.Size = math.clamp(part.Size.Magnitude / 2, 3, 20)
f.Heat = 10
if fireColors then
f.Color = fireColors[1]
f.SecondaryColor = fireColors[2]
end
f.Parent = part
fires[part] = f
n += 1
end
end
end
local function addLights()
local gap = math.max(1, math.floor(#tracked / MAX_LIGHTS))
for i = 1, #tracked, gap do
local part = tracked[i]
if part and part.Parent and not lights[part] then
local l = Instance.new("PointLight")
l.Range = 24
l.Brightness = 3
l.Color = RED
l.Parent = part
lights[part] = l
end
end
end
RunService.RenderStepped:Connect(function()
if not neonOn then return end
local t = (math.sin(os.clock() * neonSpeed * 2 * math.pi) + 1) / 2 -- smooth 0..1
local color = RED:Lerp(PINK, t)
for _, part in ipairs(tracked) do
if part.Parent then part.Color = color end
end
for _, l in pairs(lights) do
l.Color = color
l.Brightness = 1 + 4 * t
end
end)
-- a stepped (not smooth) pink/green/blue cycle for the glitch world; each part is offset
-- so they don't all flip at once, and the step rate is capped well below a strobe speed
local glitchClock = 0
RunService.Heartbeat:Connect(function(dt)
if not glitchWorldOn then return end
glitchClock += dt
local step = math.floor(glitchClock / GLITCH_STEP)
for i, part in ipairs(tracked) do
if part.Parent then part.Color = GLITCH_COLORS[((step + i) % 3) + 1] end
end
for i, f in pairs(fires) do
if f.Parent then
f.Color = GLITCH_COLORS[(step % 3) + 1]
f.SecondaryColor = GLITCH_COLORS[((step + 1) % 3) + 1]
end
end
end)
local fireVisual, neonVisual
function D.setFire(on)
fireOn = on
task.spawn(function()
if on then
ensureTracked()
addFires()
else
removeFires()
end
applyLook()
end)
if fireVisual then fireVisual(on) end
end
function D.setNeon(on)
neonOn = on
task.spawn(function()
if on then
ensureTracked()
addLights()
D.setStatus("warning: flashing colors, turn it off if that bothers you", 6)
else
removeLights()
end
applyLook()
end)
if neonVisual then neonVisual(on) end
end
function D.setFireColors(colors)
fireColors = colors
for _, f in pairs(fires) do
f.Color = colors and colors[1] or Color3.fromRGB(236, 139, 70)
f.SecondaryColor = colors and colors[2] or Color3.fromRGB(139, 80, 55)
end
end
function D.setHackerWorld(on)
hackerOn = on
task.spawn(function()
if on then ensureTracked() end
applyLook()
end)
end
function D.setGlitchWorld(on)
glitchWorldOn = on
task.spawn(function()
if on then ensureTracked() end
applyLook()
end)
end
function D.restoreWorld()
fireOn, neonOn, hackerOn, glitchWorldOn = false, false, false, false
removeFires()
removeLights()
applyLook()
tracked, original = {}, {}
if fireVisual then fireVisual(false) end
if neonVisual then neonVisual(false) end
end
fireVisual = D.toggle("Set on fire", D.LEFT, 11, function(on) D.setFire(on) end)
neonVisual = D.toggle("Neon storm", D.RIGHT, 11, function(on) D.setNeon(on) end)
D.numberBox("DestNeonSpeed", "Flash speed (2, max 5)", D.LEFT, 12, function(n)
neonSpeed = n and math.clamp(n, 0.2, 5) or 2
end)
local restoreBtn = D.button("restore world", D.RIGHT, 12, "DestRestoreBtn")
restoreBtn.MouseButton1Click:Connect(function()
D.restoreWorld()
D.setStatus("world restored")
end)
end
---------------------------------------------------------------
-- 3) personas: JOHN DOE and HACKER (commands)
---------------------------------------------------------------
D.heading("JOHN DOE / HACKER", 13)
do
local Lighting = game:GetService("Lighting")
local BLACK = Color3.new(0, 0, 0)
local RED_NEON = Color3.fromRGB(255, 0, 30)
local GREEN_NEON = Color3.fromRGB(0, 255, 60)
local PERSONAS = {
john = {
eyeColor = Color3.fromRGB(255, 0, 0),
accent = RED_NEON, -- the trim on the sword
fireColor = nil, -- normal fire
flying = true,
sword = true,
platforms = true,
billboard = true,
boardColor = "#720505",
messages = { "burn in hell", "YOUR A NOOB", "GiVe uP" },
messageColor = Color3.fromRGB(255, 0, 0),
skyId = 18519857258,
greenWorld = false,
},
hacker = {
eyeColor = GREEN_NEON,
accent = GREEN_NEON,
fireColor = { Color3.fromRGB(0, 255, 60), Color3.fromRGB(0, 120, 30) },
flying = false,
sword = true,
platforms = false,
billboard = true,
boardColor = "#18571A",
messages = {
"H̶̡̱̅A̸̢̼̍C̵̩̑̈́K̷̝̮͝Ȇ̴̗̖̊R̵͓̈́͑",
"U̸̬̽̅N̶̮̫̈́͒S̵̜͖̈́̂T̶͇̦̅O̶̗̕Ṗ̶̪P̶̜̩̏Ą̷͇͝͝B̷̗̙̕L̸̪̫͂̆Ĕ̷̖̾",
"N̶̥͑͑Ô̸͚B̸̼̅O̸̗͗͆D̸̠͚͂Y̸̪̳̔ ̵̗̻͑̀Ľ̷̳̇Ò̵͇V̶̻͗Ẽ̵͚̙̔S̷̟̘̎̇ ̵̳̪̅̚Y̶̱̎͂O̷̺̬͆̋Ụ̸̿͜",
},
messageColor = Color3.fromRGB(0, 255, 60),
skyId = 5456915026,
greenWorld = true,
},
glitch = {
eyeColor = Color3.fromRGB(255, 0, 170), -- overridden every frame by the flasher
accent = nil,
fireColor = nil,
flying = true, -- floats/glitches in place rather than walking normally
sword = false,
platforms = false,
billboard = false,
messages = nil,
skyId = 3128134660,
greenWorld = false,
glitchWorld = true, -- pink/green/blue world AND fire instead of the usual black/orange
flashEyes = true, -- eyes rapidly flash between pink/green/blue
aura = true, -- a glitch aura of coloured light/particles around you
heavyGlitch = true, -- more frequent, stronger glitch jitter
},
}
local active, activeName = false, nil
local loopToken = 0
local savedLook, savedClothes, eyes, avatarFires, auraParts = {}, {}, {}, {}, {}
local animateScript, oldHip
local motors, motorList = {}, {}
local swordFolder, boardGui
local personaSky, skyBackup
local bossSound
local visuals = {} -- persona name -> toggle setter
-- how big your avatar is (1 = normal); the eyes, sword and title follow it
local function charScale(char)
local ok, value = pcall(function() return char:GetScale() end)
return (ok and value) or 1
end
---------------------------------------------------------
-- sky
---------------------------------------------------------
local function restoreSky()
if personaSky then
personaSky:Destroy()
personaSky = nil
end
if skyBackup then
for _, c in ipairs(skyBackup) do c.Parent = Lighting end
skyBackup = nil
end
end
local function applySky(token, id)
local url
if shared.findWorkingUrl then url = shared.findWorkingUrl(id) end
url = url or ("rbxassetid://" .. id)
if not active or loopToken ~= token then return end
if not skyBackup then
skyBackup = {}
for _, c in ipairs(Lighting:GetChildren()) do
if c:IsA("Sky") then
c.Parent = nil
table.insert(skyBackup, c)
end
end
end
if personaSky then personaSky:Destroy() end
personaSky = Instance.new("Sky")
personaSky.Name = "TrollHubPersonaSky"
for _, prop in ipairs({ "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }) do
personaSky[prop] = url
end
personaSky.Parent = Lighting
end
---------------------------------------------------------
-- gear: glowing eyes, sword and title (all sized to your avatar)
---------------------------------------------------------
local function makeEye(char, head, x, color)
local hs = head.Size.Y / 1.2 -- 1 for a normal R15 head
local eye = Instance.new("Part")
eye.Name = "PersonaEye"
eye.Size = Vector3.new(0.28, 0.14, 0.1) * hs
eye.Material = Enum.Material.Neon
eye.Color = color
eye.CanCollide = false
eye.CanQuery = false
eye.CanTouch = false
eye.Massless = true
eye.CastShadow = false
eye.CFrame = head.CFrame * CFrame.new(x * hs, 0.1 * hs, -head.Size.Z / 2 - 0.02 * hs)
local weld = Instance.new("Weld")
weld.Part0 = head
weld.Part1 = eye
weld.C0 = head.CFrame:ToObjectSpace(eye.CFrame)
weld.Parent = eye
local light = Instance.new("PointLight")
light.Color = color
light.Range = 6 * hs
light.Brightness = 2
light.Parent = eye
eye.Parent = char
table.insert(eyes, eye)
end
local FIRE_PARTS = {
"Head", "UpperTorso", "Torso", "RightUpperArm", "LeftUpperArm", "Right Arm", "Left Arm",
"RightUpperLeg", "LeftUpperLeg", "Right Leg", "Left Leg",
}
local function addAvatarFire(char, colors)
for _, name in ipairs(FIRE_PARTS) do
local part = char:FindFirstChild(name)
if part and part:IsA("BasePart") then
local f = Instance.new("Fire")
f.Size = 4
f.Heat = 8
if colors then
f.Color = colors[1]
f.SecondaryColor = colors[2]
end
f.Parent = part
table.insert(avatarFires, f)
end
end
end
-- a black neon sword with colored neon trim, held in your right hand (not a Tool)
-- a small ring of coloured light + sparkle particles that follows your body (the "glitch aura")
local AURA_COLORS = { Color3.fromRGB(255, 0, 170), Color3.fromRGB(0, 255, 100), Color3.fromRGB(0, 150, 255) }
local function buildAura(char)
local root = char:FindFirstChild("HumanoidRootPart")
if not root then return end
local sc = charScale(char)
for i = 1, 3 do
local part = Instance.new("Part")
part.Name = "PersonaAura"
part.Size = Vector3.new(0.4, 0.4, 0.4) * sc
part.Transparency = 1
part.CanCollide = false
part.CanQuery = false
part.CanTouch = false
part.Massless = true
part.CastShadow = false
part.CFrame = root.CFrame
part.Parent = char
local weld = Instance.new("Weld")
weld.Part0 = root
weld.Part1 = part
weld.C0 = CFrame.new(0, 0, 0)
weld.Parent = part
local light = Instance.new("PointLight")
light.Color = AURA_COLORS[i]
light.Range = 14 * sc
light.Brightness = 2
light.Parent = part
local attachment = Instance.new("Attachment")
attachment.Parent = part
local sparkle = Instance.new("ParticleEmitter")
sparkle.Texture = "rbxasset://textures/particles/sparkles_main.dds"
sparkle.Color = ColorSequence.new(AURA_COLORS[i])
sparkle.Lifetime = NumberRange.new(0.4, 0.8)
sparkle.Rate = 18
sparkle.Speed = NumberRange.new(2, 4)
sparkle.SpreadAngle = Vector2.new(180, 180)
sparkle.Size = NumberSequence.new(0.5 * sc)
sparkle.Parent = attachment
table.insert(auraParts, part)
end
end
local function buildSword(char, accent)
local sc = charScale(char)
local hand = char:FindFirstChild("RightHand")
local handOffset = CFrame.new(0, -0.3 * sc, 0)
if not hand then
hand = char:FindFirstChild("Right Arm")
handOffset = CFrame.new(0, -1 * sc, 0)
end
if not hand then return end
local folder = Instance.new("Folder")
folder.Name = "TrollHubSword"
folder.Parent = char
local function newPart(x, y, z, color, shape)
local part = Instance.new("Part")
part.Size = Vector3.new(x, y, z) * sc
part.Color = color
part.Material = Enum.Material.Neon
part.CanCollide = false
part.CanQuery = false
part.CanTouch = false
part.Massless = true
part.CastShadow = false
if shape then part.Shape = shape end
return part
end
-- the blade points along the handle's +Y; the weld turns that to run along your arm
local handle = newPart(0.28, 1.0, 0.28, BLACK)
handle.Name = "SwordHandle"
handle.CFrame = hand.CFrame * handOffset * CFrame.Angles(math.pi, 0, 0)
local gripWeld = Instance.new("Weld")
gripWeld.Part0 = hand
gripWeld.Part1 = handle
gripWeld.C0 = handOffset * CFrame.Angles(math.pi, 0, 0)
gripWeld.Parent = handle
handle.Parent = folder
local function attach(part, x, y, z, extra)
local offset = CFrame.new(x * sc, y * sc, z * sc) * (extra or CFrame.new())
part.CFrame = handle.CFrame * offset
local w = Instance.new("Weld")
w.Part0 = handle
w.Part1 = part
w.C0 = offset
w.Parent = part
part.Parent = folder
end
attach(newPart(0.5, 0.5, 0.5, accent, Enum.PartType.Ball), 0, -0.6, 0) -- pommel
attach(newPart(0.3, 0.28, 1.9, BLACK), 0, 0.62, 0) -- guard
attach(newPart(0.34, 0.34, 0.34, accent), 0, 0.62, 0.95)
attach(newPart(0.34, 0.34, 0.34, accent), 0, 0.62, -0.95)
attach(newPart(0.14, 3.6, 0.62, BLACK), 0, 2.56, 0) -- blade
attach(newPart(0.17, 3.0, 0.1, accent), 0, 2.5, 0) -- center strip
attach(newPart(0.16, 3.6, 0.05, accent), 0, 2.56, 0.31) -- edges
attach(newPart(0.16, 3.6, 0.05, accent), 0, 2.56, -0.31)
attach(newPart(0.14, 0.62, 0.62, BLACK), 0, 4.36, 0, CFrame.Angles(math.rad(45), 0, 0)) -- tip
swordFolder = folder
end
local function buildBillboard(char, cfg)
local head = char:FindFirstChild("Head")
if not head then return end
local gui = Instance.new("BillboardGui")
gui.Name = "TrollHubPersonaTitle"
gui.Adornee = head
gui.Size = UDim2.fromOffset(340, 80)
gui.StudsOffset = Vector3.new(0, 3.2 * charScale(char), 0)
gui.AlwaysOnTop = true
gui.MaxDistance = 500
gui.Parent = head
local label = Instance.new("TextLabel")
label.Size = UDim2.fromScale(1, 1)
label.BackgroundTransparency = 1
label.Text = "ULTIMATE HACKER"
label.Font = Enum.Font.Creepster
label.TextScaled = true
label.TextColor3 = Color3.fromHex(cfg.boardColor)
label.TextStrokeColor3 = Color3.fromHex("#000000")
label.TextStrokeTransparency = 0
label.Parent = gui
boardGui = gui
end
local function clearGear()
for _, eye in ipairs(eyes) do eye:Destroy() end
eyes = {}
for _, part in ipairs(auraParts) do part:Destroy() end
auraParts = {}
if swordFolder then
swordFolder:Destroy()
swordFolder = nil
end
if boardGui then
boardGui:Destroy()
boardGui = nil
end
end
local function buildGear(char, cfg)
local head = char:FindFirstChild("Head")
if head then
makeEye(char, head, -0.25, cfg.eyeColor)
makeEye(char, head, 0.25, cfg.eyeColor)
end
if cfg.sword then buildSword(char, cfg.accent) end
if cfg.billboard then buildBillboard(char, cfg) end
if cfg.aura then buildAura(char) end
end
---------------------------------------------------------
-- glitchy R6-style animation drawn on your R15 joints:
-- idle, walk, run, jump, fall, climb, swim and sit, plus sword slashes
---------------------------------------------------------
local POSED = {
"RightShoulder", "LeftShoulder", "RightElbow", "LeftElbow", "Neck", "Waist",
"RightHip", "LeftHip", "RightKnee", "LeftKnee",
}
local function bindAnimation(cfg)
local flying, sword = cfg.flying, cfg.sword
local heavy = cfg.heavyGlitch
local flashEyes = cfg.flashEyes
local flashFire = cfg.glitchWorld -- also cycle your own body's fire, in sync with the eyes
local eyeFlashClock, eyeFlashStep = 0, 0.2 -- 5 switches/sec: fast, but capped well below a strobe
local flashColors = { Color3.fromRGB(255, 0, 170), Color3.fromRGB(0, 255, 100), Color3.fromRGB(0, 150, 255) }
local char = player.Character
-- finds the joints on R15 and R6 characters
motorList, motors = shared.findJoints(char)
for _, m in ipairs(motorList) do m.Transform = CFrame.new() end
if next(motors) == nil then
D.setStatus("this game's character isn't supported for the glitchy animation", 6)
end
local phase, heldPhase = 0, 0
local nextGlitch = os.clock() + (heavy and 0.2 or 0.5)
local glitchUntil, frozen = 0, false
local slashStart, nextSlash = nil, os.clock() + 2 + math.random() * 3
pcall(function() RunService:UnbindFromRenderStep("TrollHubPersonaPose") end)
RunService:BindToRenderStep("TrollHubPersonaPose", Enum.RenderPriority.Last.Value, function(dt)
local h, r = getHumanoid(), getRoot()
if not (h and r) then return end
local now = os.clock()
-- keep the game's own animations from taking over (some games restart them constantly)
local animator = h:FindFirstChildOfClass("Animator")
if animator then
for _, track in ipairs(animator:GetPlayingAnimationTracks()) do
if not (shared.keepTracks and shared.keepTracks[track]) then track:Stop(0) end
end
end
-- which move are you doing?
local state = h:GetState()
local v = r.AssemblyLinearVelocity
local speed = Vector3.new(v.X, 0, v.Z).Magnitude
local move
if h.Sit or state == Enum.HumanoidStateType.Seated then
move = "sit"
elseif state == Enum.HumanoidStateType.Swimming then
move = "swim"
elseif state == Enum.HumanoidStateType.Climbing then
move = "climb"
elseif state == Enum.HumanoidStateType.Jumping then
move = "jump"
elseif state == Enum.HumanoidStateType.Freefall then
move = "fall"
elseif speed > 20 then
move = "run"
elseif speed > 1 then
move = "walk"
else
move = "idle"
end
phase += dt * ((move == "run" and 15) or (move == "walk" and 9) or ((move == "climb" or move == "swim") and 6) or 0)
-- glitch bursts: every so often the pose jitters wildly or freezes for a moment
if now >= nextGlitch then
if heavy then
glitchUntil = now + 0.15 + math.random() * 0.25
nextGlitch = glitchUntil + 0.15 + math.random() * 0.5
frozen = math.random() < 0.25
else
glitchUntil = now + 0.08 + math.random() * 0.17
nextGlitch = glitchUntil + 0.8 + math.random() * 2.2
frozen = math.random() < 0.4
end
end
local glitching = now < glitchUntil
-- stepped, robotic motion (and stuck still during a "frozen" glitch)
local stepped = math.floor(phase / 0.5) * 0.5
if glitching and frozen then stepped = heldPhase else heldPhase = stepped end
local s = math.sin(stepped)
local angles = {}
local function pose(name, x, y, z) angles[name] = Vector3.new(x or 0, y or 0, z or 0) end
if move == "walk" or move == "run" then
local fast = move == "run"
if flying then
-- gliding forward: leaning in, legs trailing
pose("Waist", fast and -0.6 or -0.35)
pose("LeftShoulder", (fast and -1.2 or -0.8) + s * 0.2)
pose("RightHip", (fast and -0.7 or -0.4) + s * 0.2)
pose("LeftHip", (fast and -0.7 or -0.5) - s * 0.2)
pose("Neck", 0.3, 0, math.sin(stepped * 0.5) * 0.05)
else
-- stiff R6 walk
local swing = fast and 1.1 or 0.8
pose("LeftShoulder", -s * swing)
pose("RightHip", -s * swing)
pose("LeftHip", s * swing)
pose("Waist", fast and -0.2 or -0.05)
pose("Neck", 0, 0, math.sin(stepped * 0.5) * 0.05)
end
if sword then
pose("RightShoulder", (fast and 1.4 or 1.2) + s * 0.06) -- sword held out front
else
pose("RightShoulder", s * (fast and 1.1 or 0.8))
end
elseif move == "jump" then
if sword then
pose("RightShoulder", 2.7) -- sword raised overhead
pose("LeftShoulder", 0, 0, -2.2)
else
pose("RightShoulder", 0, 0, 2.4)
pose("LeftShoulder", 0, 0, -2.4)
end
pose("RightHip", 0, 0, 0.15)
pose("LeftHip", 0, 0, -0.15)
pose("Neck", -0.2)
elseif move == "fall" then
if sword then
pose("RightShoulder", 1.6)
pose("LeftShoulder", 0, 0, -1.4)
else
pose("RightShoulder", 0, 0, 1.6)
pose("LeftShoulder", 0, 0, -1.6)
end
pose("RightHip", 0, 0, 0.4)
pose("LeftHip", 0, 0, -0.4)
elseif move == "climb" then
pose("RightShoulder", 2.6 + s * 0.5)
pose("LeftShoulder", 2.6 - s * 0.5)
pose("RightHip", -s * 0.5)
pose("LeftHip", s * 0.5)
elseif move == "swim" then
pose("Waist", -1.1)
pose("Neck", 0.8)
pose("RightShoulder", 2.0 + s * 1.2)
pose("LeftShoulder", 2.0 - s * 1.2)
pose("RightHip", s * 0.5)
pose("LeftHip", -s * 0.5)
elseif move == "sit" then
pose("RightHip", 1.55)
pose("LeftHip", 1.55)
pose("RightShoulder", sword and 1.0 or 0.3)
pose("LeftShoulder", 0.3)
else -- idle
if sword then
-- ready stance: sword out front, other arm back for balance
pose("RightShoulder", 1.2 + math.sin(now * 1.5) * 0.05)
pose("LeftShoulder", 0, 0, -0.45 + math.sin(now * 1.2) * 0.08)
else
pose("RightShoulder", 0, 0, 0.08 + math.sin(now * 1.3) * 0.05)
pose("LeftShoulder", 0, 0, -0.08 - math.sin(now * 1.1) * 0.05)
end
if flying then
pose("RightHip", 0.1, 0, 0.1)
pose("LeftHip", -0.15, 0, -0.1)
end
pose("Neck", 0, math.sin(now * 0.9) * 0.2, 0)
end
-- sword slash: wind up overhead, then cut down while the body twists
if sword and not slashStart and now >= nextSlash
and move ~= "sit" and move ~= "swim" and move ~= "climb" then
slashStart = now
end
if slashStart then
local t = (now - slashStart) / 0.6
if t >= 1 then
slashStart = nil
nextSlash = now + 2.5 + math.random() * 3.5
elseif t < 0.3 then
local u = t / 0.3
pose("RightShoulder", 1.3 + 1.6 * u)
angles.Waist = Vector3.new(angles.Waist and angles.Waist.X or 0, -0.5 * u, 0)
pose("LeftShoulder", 0, 0, -0.9 * u)
else
local u = (t - 0.3) / 0.7
u = u * u * (3 - 2 * u) -- ease
pose("RightShoulder", 2.9 - 2.3 * u)
angles.Waist = Vector3.new(angles.Waist and angles.Waist.X or 0, -0.5 + 1.1 * u, 0)
pose("LeftShoulder", 0, 0, -0.9 + 0.5 * u)
end
end
for _, name in ipairs(POSED) do
local motor = motors[name]
if motor then
local base = angles[name] or Vector3.zero
local jitter = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5)
if glitching and not frozen then
jitter *= (name == "Neck" and 2.0 or 1.4) * (heavy and 1.6 or 1) -- wild jitter during a glitch
else
jitter *= heavy and 0.1 or 0.03 -- constant tiny twitch (a bit more for the glitch persona)
end
local total = base + jitter
shared.applyJoint(motor, total.X, total.Y, total.Z)
end
end
-- rapidly flash the eyes (and your body's fire) between pink/green/blue, stepped rather
-- than a smooth fade, but capped at 5 switches a second so it's not a fast strobe
if (flashEyes or flashFire) and eyeFlashStep > 0 then
eyeFlashClock += dt
local step = math.floor(eyeFlashClock / eyeFlashStep)
if flashEyes then
for i, eye in ipairs(eyes) do
local c = flashColors[((step + i) % 3) + 1]
eye.Color = c
local light = eye:FindFirstChildOfClass("PointLight")
if light then light.Color = c end
end
end
if flashFire then
for _, f in ipairs(avatarFires) do
if f.Parent then
f.Color = flashColors[(step % 3) + 1]
f.SecondaryColor = flashColors[((step + 1) % 3) + 1]
end
end
end
end
-- flying: hover above the ground and bob a little
if flying and oldHip then
local target = oldHip + 4 * charScale(h.Parent) + math.sin(now * 2) * 0.4
h.HipHeight = h.HipHeight + (target - h.HipHeight) * math.min(1, dt * 6)
end
end)
end
---------------------------------------------------------
-- small black platforms that appear under your feet
---------------------------------------------------------
local function startPlatforms(token)
task.spawn(function()
local folder = Instance.new("Folder")
folder.Name = "TrollHubPlatforms"
folder.Parent = workspace
local alive = 0
while active and loopToken == token do
local r, hum = getRoot(), getHumanoid()
if r and hum and alive < 60 then
local sc = charScale(hum.Parent)
local feetY = r.Position.Y - (hum.HipHeight + r.Size.Y / 2) - 0.3 * sc
local size = (1.5 + math.random() * 2) * sc
local sq = Instance.new("Part")
sq.Size = Vector3.new(size, 0.3 * sc, size)
sq.Anchored = true
sq.CanCollide = false
sq.CanQuery = false
sq.CanTouch = false
sq.CastShadow = false
sq.Material = Enum.Material.Neon
sq.Color = BLACK
sq.CFrame = CFrame.new(
r.Position.X + (math.random() - 0.5) * 6 * sc, feetY, r.Position.Z + (math.random() - 0.5) * 6 * sc
) * CFrame.Angles(0, math.random() * math.pi, 0)
sq.Parent = folder
local life = 0.6 + math.random() * 0.5
TweenService:Create(sq, TweenInfo.new(life), { Size = Vector3.new(0.1, 0.3 * sc, 0.1) }):Play()
alive += 1
task.delay(life, function()
if sq.Parent then sq:Destroy() end
alive -= 1
end)
end
task.wait(0.08)
end
folder:Destroy()
end)
end
---------------------------------------------------------
-- words that come out of your avatar
---------------------------------------------------------
local function startMessages(token, messages, textColor)
task.spawn(function()
local words = Instance.new("Folder")
words.Name = "TrollHubWords"
words.Parent = workspace
local alive = 0
local lastChat, chatIndex = 0, 0
while active and loopToken == token do
local char = player.Character
local r = getRoot()
if char and r and alive < 30 then
local sc = charScale(char)
local bodyParts = {}
for _, d in ipairs(char:GetChildren()) do
if d:IsA("BasePart") and d.Name ~= "HumanoidRootPart" and d.Name ~= "PersonaEye" then
table.insert(bodyParts, d)
end
end
local source = bodyParts[math.random(#bodyParts)] or r
local jitter = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5) * 0.6 * sc
local start = source.Position + jitter
local outward = start - r.Position
if outward.Magnitude < 0.1 then
outward = Vector3.new(math.random() - 0.5, 0.2, math.random() - 0.5)
end
local random = Vector3.new(math.random() - 0.5, 0.4 + math.random() * 0.4, math.random() - 0.5)
local direction = (outward.Unit + random).Unit
local distance = (10 + math.random() * 10) * math.max(sc, 0.5)
local life = 1.6 + math.random() * 0.8
local anchor = Instance.new("Part")
anchor.Size = Vector3.new(0.2, 0.2, 0.2)
anchor.Transparency = 1
anchor.Anchored = true
anchor.CanCollide = false
anchor.CanQuery = false
anchor.CanTouch = false
anchor.CastShadow = false
anchor.Position = start
anchor.Parent = words
local gui = Instance.new("BillboardGui")
gui.Adornee = anchor
gui.Size = UDim2.fromOffset(300, 80)
gui.AlwaysOnTop = true
gui.MaxDistance = 400
gui.Parent = anchor
local label = Instance.new("TextLabel")
label.Size = UDim2.fromScale(1, 1)
label.BackgroundTransparency = 1
label.Text = messages[math.random(#messages)]
label.Font = Enum.Font.Creepster
label.TextScaled = true
label.TextColor3 = textColor
label.TextStrokeColor3 = BLACK
label.TextStrokeTransparency = 0
label.Parent = gui
TweenService:Create(anchor, TweenInfo.new(life, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{ Position = start + direction * distance }):Play()
task.delay(life * 0.4, function()
TweenService:Create(label, TweenInfo.new(life * 0.6),
{ TextTransparency = 1, TextStrokeTransparency = 1 }):Play()
end)
alive += 1
task.delay(life + 0.1, function()
if anchor.Parent then anchor:Destroy() end
alive -= 1
end)
end
if os.clock() - lastChat > 1.6 then
lastChat = os.clock()
chatIndex = chatIndex % #messages + 1
showFakeMessage(player.DisplayName, messages[chatIndex])
end
task.wait(0.3)
end
words:Destroy()
end)
end
---------------------------------------------------------
-- start / stop
---------------------------------------------------------
local function stopPersona()
active, activeName = false, nil
shared.poseOwner = nil
loopToken += 1
pcall(function() RunService:UnbindFromRenderStep("TrollHubPersonaPose") end)
for obj, info in pairs(savedLook) do
if obj.Parent then
if obj:IsA("Decal") then
obj.Transparency = info.transparency
else
obj.Color = info.color
obj.Material = info.material
end
end
end
savedLook = {}
local char = player.Character
for _, info in ipairs(savedClothes) do
if char then info[1].Parent = char end
end
savedClothes = {}
clearGear()
for _, f in ipairs(avatarFires) do f:Destroy() end
avatarFires = {}
if bossSound then
bossSound:Destroy()
bossSound = nil
end
if animateScript then
pcall(function() animateScript.Disabled = false end)
animateScript = nil
end
local hum = getHumanoid()
if hum and oldHip then hum.HipHeight = oldHip end
oldHip = nil
for _, motor in ipairs(motorList) do
if motor.Parent then motor.Transform = CFrame.new() end
end
motors, motorList = {}, {}
for _, folderName in ipairs({ "TrollHubPlatforms", "TrollHubWords" }) do
local folder = workspace:FindFirstChild(folderName)
if folder then folder:Destroy() end
end
restoreSky()
D.setFire(false)
D.setHackerWorld(false)
D.setFireColors(nil)
end
local function startPersona(name)
local cfg = PERSONAS[name]
local char, hum, root = player.Character, getHumanoid(), getRoot()
if not (cfg and char and hum and root) then
D.setStatus("no character")
return false
end
if active then stopPersona() end
active, activeName = true, name
shared.poseOwner = name
loopToken += 1
local token = loopToken
-- boss music (looping, half volume)
bossSound = Instance.new("Sound")
bossSound.Name = "TrollHubBossMusic"
bossSound.SoundId = "rbxassetid://1842940633"
bossSound.Volume = 0.5
bossSound.Looped = true
bossSound.Parent = game:GetService("SoundService")
bossSound:Play()
-- the world: new sky, fire (colored for the persona), maybe green and black
task.spawn(function() applySky(token, cfg.skyId) end)
D.setFireColors(cfg.fireColor)
D.setFire(true)
if cfg.greenWorld then D.setHackerWorld(true) end
if cfg.glitchWorld then D.setGlitchWorld(true) end
-- you: pitch black neon, no clothes, on fire
for _, d in ipairs(char:GetDescendants()) do
if d:IsA("BasePart") and d.Name ~= "HumanoidRootPart" then
savedLook[d] = { color = d.Color, material = d.Material }
d.Color = BLACK
d.Material = Enum.Material.Neon
elseif d:IsA("Decal") then
savedLook[d] = { transparency = d.Transparency }
d.Transparency = 1
end
end
for _, obj in ipairs(char:GetChildren()) do
if obj:IsA("Shirt") or obj:IsA("Pants") or obj:IsA("ShirtGraphic") or obj:IsA("CharacterMesh") then
table.insert(savedClothes, { obj })
obj.Parent = nil
end
end
addAvatarFire(char, cfg.fireColor)
buildGear(char, cfg)
-- rebuild the eyes / sword / title if you change your avatar size
local lastScale = charScale(char)
task.spawn(function()
while active and loopToken == token do
task.wait(0.4)
local c = player.Character
if c and active and loopToken == token then
local now = charScale(c)
if math.abs(now - lastScale) > 0.01 then
lastScale = now
clearGear()
buildGear(c, cfg)
end
end
end
end)
-- your normal animations stop; the glitchy ones are drawn by hand
animateScript = char:FindFirstChild("Animate")
if animateScript then pcall(function() animateScript.Disabled = true end) end
local animator = hum:FindFirstChildOfClass("Animator")
if animator then
for _, track in ipairs(animator:GetPlayingAnimationTracks()) do track:Stop(0.1) end
end
oldHip = hum.HipHeight
bindAnimation(cfg)
if cfg.platforms then startPlatforms(token) end
if cfg.messages then startMessages(token, cfg.messages, cfg.messageColor) end
return true
end
function D.setPersona(name, on)
if on then
for other, setVisual in pairs(visuals) do
if other ~= name then setVisual(false) end
end
if startPersona(name) then
if visuals[name] then visuals[name](true) end
elseif visuals[name] then
visuals[name](false)
end
else
if activeName == name then stopPersona() end
if visuals[name] then visuals[name](false) end
end
end
visuals.john = D.toggle("JOHN DOE", D.LEFT, 14, function(on) D.setPersona("john", on) end)
visuals.hacker = D.toggle("HACKER", D.RIGHT, 14, function(on) D.setPersona("hacker", on) end)
visuals.glitch = D.toggle("GLITCH", D.RIGHT, 15, function(on) D.setPersona("glitch", on) end)
-- if you respawn, the persona ends
player.CharacterAdded:Connect(function()
if active then
local was = activeName
stopPersona()
if was and visuals[was] then visuals[was](false) end
end
end)
-- command bar: john doe / hacker / glitch / fire / neon / stop
-- (shared.runDestructionCommand lets the ; mini command bar run the same commands)
local function runCommand(raw)
local c = raw:lower():gsub("^%s+", ""):gsub("%s+$", ""):gsub("%s+", " ")
if c == "" then return end
if c == "john doe" or c == "johndoe" then
D.setPersona("john", true)
elseif c == "hacker" then
D.setPersona("hacker", true)
elseif c == "glitch" then
D.setPersona("glitch", true)
elseif c == "fire" then
D.setFire(true)
elseif c == "neon" then
D.setNeon(true)
elseif c == "stop" or c == "restore" then
if activeName then D.setPersona(activeName, false) end
D.restoreWorld()
D.setStatus("everything stopped")
else
D.setStatus("commands: john doe, hacker, glitch, fire, neon, stop")
end
end
shared.runDestructionCommand = runCommand
local cmdBox = ui.input(D.content, "DestCommand", "Command (john doe, hacker, fire...)", UDim2.fromOffset(D.LEFT, D.rowY(15)), D.half)
cmdBox.FocusLost:Connect(function(enter)
if not enter then return end
local text = cmdBox.Text
cmdBox.Text = ""
runCommand(text)
end)
end
---------------------------------------------------------------
-- 4) billboard text over any player
---------------------------------------------------------------
D.heading("Billboard over a player", 16)
do
local settings = {
text = "",
font = Enum.Font.GothamBold,
color = Color3.fromRGB(255, 255, 255),
stroke = Color3.fromRGB(0, 0, 0),
size = 40,
height = 3,
alwaysOnTop = false,
}
local boards = {} -- player -> BillboardGui
local lastTarget
local targetBox = ui.input(D.content, "BoardTarget", "Player (empty = you)", UDim2.fromOffset(D.LEFT, D.rowY(17)), D.half)
local pickBtn = Instance.new("TextButton")
pickBtn.Name = "BoardSelectBtn"
pickBtn.Size = UDim2.fromOffset(192, 52)
pickBtn.Position = UDim2.fromOffset(D.RIGHT, D.rowY(17))
pickBtn.BackgroundColor3 = Color3.fromRGB(60, 120, 220)
pickBtn.BorderSizePixel = 0
pickBtn.Text = "select player"
pickBtn.Font = FONT
pickBtn.TextSize = 18
pickBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
pickBtn.ZIndex = 3
pickBtn.Parent = D.content
corner(pickBtn, 10)
pickBtn.MouseButton1Click:Connect(function()
sidebarTarget = targetBox
sidebar.Visible = not sidebar.Visible
if sidebar.Visible then refreshPlayerList() end
end)
local textBox = ui.input(D.content, "BoardText", "Billboard text", UDim2.fromOffset(D.LEFT, D.rowY(18)), D.half)
local function resolveTarget()
local name = targetBox.Text:gsub("%s", "")
if name == "" then return player end
return findPlayer(name)
end
local function removeBoard(plr)
if boards[plr] then
boards[plr]:Destroy()
boards[plr] = nil
end
end
local function applyBoard(plr)
local head = plr and plr.Character and plr.Character:FindFirstChild("Head")
if not head then
D.setStatus("that player has no character")
return
end
removeBoard(plr)
local gui = Instance.new("BillboardGui")
gui.Name = "TrollHubBoard"
gui.Adornee = head
gui.Size = UDim2.fromOffset(600, 160)
gui.StudsOffset = Vector3.new(0, settings.height, 0)
gui.AlwaysOnTop = settings.alwaysOnTop
gui.MaxDistance = 1000
gui.Parent = head
local label = Instance.new("TextLabel")
label.Size = UDim2.fromScale(1, 1)
label.BackgroundTransparency = 1
label.Text = settings.text
label.Font = settings.font
label.TextSize = settings.size
label.TextColor3 = settings.color
label.TextStrokeColor3 = settings.stroke
label.TextStrokeTransparency = 0
label.TextWrapped = true
label.Parent = gui
boards[plr] = gui
lastTarget = plr
end
-- re-apply to the last target when a setting changes
local function refreshLast()
if lastTarget and boards[lastTarget] then applyBoard(lastTarget) end
end
local fontBtn, fontLabel = ui.studButton(D.content, "Font: " .. settings.font.Name, UDim2.fromOffset(D.RIGHT, D.rowY(18)), D.half, Color3.fromRGB(60, 120, 220), "BoardFontBtn")
fontBtn.MouseButton1Click:Connect(function()
settings.font = ui.nextFont(settings.font)
fontLabel.Text = "Font: " .. settings.font.Name
refreshLast()
end)
ui.colorRow(D.content, "Text color", UDim2.fromOffset(D.LEFT, D.rowY(19)),
function() return settings.color end,
function(c)
settings.color = c
refreshLast()
end, "BoardColorBtn")
ui.colorRow(D.content, "Outline color", UDim2.fromOffset(D.RIGHT, D.rowY(19)),
function() return settings.stroke end,
function(c)
settings.stroke = c
refreshLast()
end, "BoardStrokeBtn")
D.numberBox("BoardSize", "Text size (40)", D.LEFT, 20, function(n)
settings.size = n and math.clamp(n, 8, 200) or 40
refreshLast()
end)
D.numberBox("BoardHeight", "Height above head (3)", D.RIGHT, 20, function(n)
settings.height = n and math.clamp(n, -5, 50) or 3
refreshLast()
end)
D.toggle("Always on top", D.LEFT, 21, function(on)
settings.alwaysOnTop = on
refreshLast()
end)
local applyBtn = D.button("apply billboard", D.RIGHT, 21, "BoardApplyBtn")
applyBtn.MouseButton1Click:Connect(function()
settings.text = textBox.Text
local plr = resolveTarget()
if not plr then
D.setStatus("couldn't find that player")
return
end
applyBoard(plr)
end)
local removeBtn = D.button("remove billboard", D.LEFT, 22, "BoardRemoveBtn")
removeBtn.MouseButton1Click:Connect(function()
local plr = resolveTarget()
if plr then removeBoard(plr) end
end)
local removeAllBtn = D.button("remove all", D.RIGHT, 22, "BoardRemoveAllBtn")
removeAllBtn.MouseButton1Click:Connect(function()
for plr in pairs(boards) do removeBoard(plr) end
end)
-- put a board back if that player respawns
task.spawn(function()
while true do
task.wait(1)
for plr, gui in pairs(boards) do
if not gui.Parent and plr.Parent and plr.Character and plr.Character:FindFirstChild("Head") then
applyBoard(plr)
elseif not plr.Parent then
boards[plr] = nil
end
end
end
end)
end
local pad = Instance.new("Frame")
pad.BackgroundTransparency = 1
pad.Size = UDim2.fromOffset(10, 10)
pad.Position = UDim2.fromOffset(0, D.rowY(23))
pad.Parent = D.content
end
---------------------------------------------------------------------
-- Settings tab: restyle the UI
---------------------------------------------------------------------
do
local BLUE = Color3.fromRGB(60, 120, 220)
local BG_DEFAULT = Color3.fromRGB(128, 128, 128)
local DEFAULT_THEME = {
font = theme.font,
textColor = theme.textColor,
enabledColor = theme.enabledColor,
disabledColor = theme.disabledColor,
bgTransparency = theme.bgTransparency,
bgShift = theme.bgShift,
bgColorA = theme.bgColorA,
bgColorB = theme.bgColorB,
bgSpeed = theme.bgSpeed,
}
local page = ui.page("Settings")
makeTab("Settings", 10)
tabs.Settings.MouseButton1Click:Connect(function() setTab("Settings") end)
ui.subtitle(page, "style your UI")
local content = ui.scroller(page, "SettingsContent", UDim2.fromOffset(0, 98), UDim2.new(1, 0, 1, -104))
local function applyTheme()
for _, d in ipairs(screenGui:GetDescendants()) do
if d:IsA("TextLabel") or d:IsA("TextButton") or d:IsA("TextBox") then
if d:GetAttribute("ThemeText") == nil then
d:SetAttribute("ThemeText", d.TextColor3 == Color3.new(0, 0, 0))
end
d.Font = theme.font
if d:GetAttribute("ThemeText") then d.TextColor3 = theme.textColor end
end
end
for _, render in ipairs(toggleRenders) do render() end
for _, name in ipairs(ENABLED_NAMES) do
local obj = screenGui:FindFirstChild(name, true)
if obj then obj.BackgroundColor3 = theme.enabledColor end
end
themeHooks.colorTabs()
if themeHooks.miniBar then themeHooks.miniBar() end
frame.BackgroundTransparency = theme.bgTransparency
frameStuds.BackgroundTransparency = theme.bgTransparency
frameStuds.ImageTransparency = theme.bgTransparency
if not theme.bgShift then
frame.BackgroundColor3 = BG_DEFAULT
frameStuds.BackgroundColor3 = BG_DEFAULT
end
end
themeHooks.apply = applyTheme
-- colour-changing background: fades between two colours
RunService.RenderStepped:Connect(function()
if not theme.bgShift then return end
local t = (math.sin(os.clock() * theme.bgSpeed) + 1) / 2
local c = theme.bgColorA:Lerp(theme.bgColorB, t)
frame.BackgroundColor3 = c
frameStuds.BackgroundColor3 = c
end)
local refreshers = {}
local function colorRow(key, text, position, name)
local refresh = ui.colorRow(content, text, position,
function() return theme[key] end,
function(c)
theme[key] = c
applyTheme()
end, name)
table.insert(refreshers, refresh)
end
local fontBtn, fontLabel = ui.studButton(content, "Font: " .. theme.font.Name, UDim2.fromOffset(22, 4), UDim2.fromOffset(192, 56), BLUE, "UiFontBtn")
fontBtn.MouseButton1Click:Connect(function()
theme.font = ui.nextFont(theme.font)
fontLabel.Text = "Font: " .. theme.font.Name
applyTheme()
end)
colorRow("textColor", "Text color", UDim2.fromOffset(266, 4), "UiTextColorBtn")
colorRow("enabledColor", "Enabled color", UDim2.fromOffset(22, 68), "UiEnabledColorBtn")
colorRow("disabledColor", "Disabled color", UDim2.fromOffset(266, 68), "UiDisabledColorBtn")
local boxes = {}
local transBox = ui.input(content, "UiBgTransparency", "Background transparency (0-1)", UDim2.fromOffset(22, 132))
table.insert(boxes, transBox)
transBox.Text = tostring(theme.bgTransparency)
transBox.FocusLost:Connect(function()
local n = tonumber(transBox.Text)
if transBox.Text:gsub("%s", "") == "" then
theme.bgTransparency = DEFAULT_THEME.bgTransparency
elseif n then
theme.bgTransparency = math.clamp(n, 0, 1)
else
ui.flashInvalid(transBox, "type a number 0-1")
return
end
applyTheme()
end)
local setShiftVisual = makeToggle("Color shift", UDim2.fromOffset(266, 132), function(on)
theme.bgShift = on
applyTheme()
end, content, UDim2.fromOffset(192, 56))
setShiftVisual(theme.bgShift) -- starts ON by default
colorRow("bgColorA", "Shift color A", UDim2.fromOffset(22, 196), "UiBgColorABtn")
colorRow("bgColorB", "Shift color B", UDim2.fromOffset(266, 196), "UiBgColorBBtn")
local speedBox = ui.input(content, "UiBgSpeed", "Shift speed (1)", UDim2.fromOffset(22, 260))
table.insert(boxes, speedBox)
speedBox.Text = tostring(theme.bgSpeed)
speedBox.FocusLost:Connect(function()
local n = tonumber(speedBox.Text)
if speedBox.Text:gsub("%s", "") == "" then
theme.bgSpeed = DEFAULT_THEME.bgSpeed
elseif n then
theme.bgSpeed = math.clamp(n, 0.1, 20)
else
ui.flashInvalid(speedBox, "type a number")
end
end)
local resetBtn = ui.studButton(content, "reset style", UDim2.fromOffset(266, 260), UDim2.fromOffset(192, 56), BLUE, "UiResetBtn")
resetBtn.MouseButton1Click:Connect(function()
for key, value in pairs(DEFAULT_THEME) do theme[key] = value end
fontLabel.Text = "Font: " .. theme.font.Name
transBox.Text = tostring(theme.bgTransparency)
speedBox.Text = tostring(theme.bgSpeed)
for _, refresh in ipairs(refreshers) do refresh() end
setShiftVisual(theme.bgShift)
applyTheme()
end)
local pad = Instance.new("Frame")
pad.BackgroundTransparency = 1
pad.Size = UDim2.fromOffset(10, 10)
pad.Position = UDim2.fromOffset(0, 332)
pad.Parent = content
applyTheme() -- tag everything and apply the starting style
end
---------------------------------------------------------------------
-- layout: every page sits to the right of the tab column
---------------------------------------------------------------------
for _, pg in pairs(pages) do
pg.Position = UDim2.fromOffset(TAB_W, 0)
pg.Size = UDim2.new(1, -TAB_W, 1, 0)
end
---------------------------------------------------------------------
-- mini command bar: press ; to open a small command box, bottom-right corner
-- (runs the same commands as the Destruction tab's command box)
---------------------------------------------------------------------
do
local bar = Instance.new("Frame")
bar.Name = "MiniCommandBar"
bar.AnchorPoint = Vector2.new(1, 1)
bar.Size = UDim2.fromOffset(280, 44)
bar.Position = UDim2.new(1, -16, 1, -16)
bar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
bar.BorderSizePixel = 0
bar.Visible = false
bar.ZIndex = 20
bar.Parent = screenGui
corner(bar, 10)
local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(60, 120, 220)
stroke.Thickness = 2
stroke.Parent = bar
local box = Instance.new("TextBox")
box.Name = "MiniCommandInput"
box.Size = UDim2.new(1, -20, 1, -12)
box.Position = UDim2.fromOffset(10, 6)
box.BackgroundTransparency = 1
box.Text = ""
box.PlaceholderText = "type cmd here"
box.PlaceholderColor3 = Color3.fromRGB(140, 140, 140)
box.TextColor3 = theme.textColor
box.Font = theme.font
box.TextSize = 18
box.TextXAlignment = Enum.TextXAlignment.Left
box.ClearTextOnFocus = false
box.ZIndex = 21
box:SetAttribute("ThemeText", true)
box.Parent = bar
-- font/text colour are handled by the generic ThemeText pass in applyTheme;
-- this just keeps the border matching the "enabled" colour
themeHooks.miniBar = function()
stroke.Color = theme.enabledColor
end
local function openBar()
bar.Visible = true
box:CaptureFocus()
end
local function closeBar()
bar.Visible = false
box.Text = ""
end
UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.Semicolon and not UserInputService:GetFocusedTextBox() then
openBar()
end
end)
box.FocusLost:Connect(function(enter)
local text = box.Text
closeBar()
if enter and text:gsub("%s", "") ~= "" then
if shared.runDestructionCommand then
shared.runDestructionCommand(text)
end
end
end)
end