local plrs = game:GetService("Players") local run = game:GetService("RunService") local uis = game:GetService("UserInputService") local cas = game:GetService("ContextActionService") local tweens = game:GetService("TweenService") local prompt = game:GetService("ProximityPromptService") local starter = game:GetService("StarterGui") local guis = game:GetService("GuiService") local plr = plrs.LocalPlayer local pgui = plr:WaitForChild("PlayerGui") local conf = { hide = true, speed = 40, range = 20, tween = 30, smooth = 10, sure = 3, sens = 0.35, reach = 5000, thick = 0.12, pieces = 12, glow = -1, noise = "rbxasset://textures/noise.dds", shown = 7, } local white = Color3.new(1, 1, 1) local black = Color3.new(0, 0, 0) local grey = Color3.fromRGB(138, 138, 138) local navy = Color3.fromRGB(18, 52, 120) local blue = Color3.fromRGB(74, 160, 222) local key = Enum.KeyCode local mouse = Enum.UserInputType local binds = { open = key.K, fwd = key.W, back = key.S, left = key.A, right = key.D, rise = key.E, drop = key.Q, fast = key.LeftShift, slow = key.C, faster = key.RightBracket, slower = key.LeftBracket, look = mouse.MouseButton2, add = key.F, pick = mouse.MouseButton1, grab = key.G, undo = key.Z, del = key.X, prev = key.Comma, later = key.Period, swap = key.V, wheel = mouse.MouseWheel, mup = key.Up, mdown = key.Down, mleft = key.Left, mright = key.Right, use = key.Return, done = key.T, exit = key.Backspace, } local names = { MouseButton1 = "lmb", MouseButton2 = "rmb", Return = "enter", } local why = { range = "switch placement to normal first.", add = "place the one you're holding first.", move = "click a clone to select it first.", del = "click a clone to select it first.", order = "select a clone first. you need at least two.", done = "place at least one clone first.", path = "there's nothing in the path.", copy = "there's nothing to make a script from.", stop = "you're not moving right now.", floor = "there's no room for it here. try another spot.", } local arimo = Enum.Font.Arimo local left = Enum.TextXAlignment.Left local right = Enum.TextXAlignment.Right local sort = Enum.SortOrder.LayoutOrder local autox = Enum.AutomaticSize.X local autoy = Enum.AutomaticSize.Y local side = Enum.FillDirection.Horizontal local center = Enum.VerticalAlignment.Center local rows = { { "mode", "placement", "raycast sits clones on the ground, normal puts them in the air. press v to switch." }, { "speed", "fly speed", "use [ and ] to change it. hold shift to go faster or c to go slower." }, { "range", "distance", "how far away clones go in normal mode. you can also scroll." }, { "add", "new clone", "make a new clone and place it." }, { "move", "move clone", "pick up the selected clone, or place the one you're holding." }, { "order", "clone order", "change where the selected clone is in the path. you can also use , and ." }, { "del", "delete clone", "remove the selected clone." }, { "done", "finish", "stop editing and get your positions." }, { "exit", "exit", "leave without keeping the path." }, } local buttons = { { "copy", "make script", "make a script that tweens your character through the path." }, { "path", "tween path", "go through the whole path in order." }, { "stop", "stop tween", "stop where you are." }, { "close", "close", "remove the path and close this." }, } local tips = { { "fly", "fly", "w a s d q e" }, { "look", "look" }, { "add", "new" }, { "pick", "select" }, { "grab", "move" }, { "undo", "cancel" }, { "del", "delete" }, { "done", "finish" }, { "use", "select" }, { "exit", "exit" }, } local function make(class, parent, name, props) local inst = Instance.new(class) inst.Name = name if inst:IsA("GuiObject") then inst.BorderSizePixel = 0 inst.BackgroundColor3 = white end if inst:IsA("TextLabel") or inst:IsA("TextButton") or inst:IsA("TextBox") then inst.BackgroundTransparency = 1 inst.Text = "" inst.Font = arimo inst.TextSize = 19 inst.TextColor3 = white end for prop, val in props or {} do inst[prop] = val end inst.Parent = parent return inst end local function panel(parent, name, order, shade) local frame = make("Frame", parent, name, { Size = UDim2.fromScale(1, 0), AutomaticSize = autoy, BackgroundColor3 = black, BackgroundTransparency = 0.18, LayoutOrder = order, }) make("UIGradient", frame, "fade", { Rotation = 90, Transparency = NumberSequence.new(0, shade) }) make("UIListLayout", frame, "layout", { SortOrder = sort }) return frame end local function entry(class, parent, name, order, text, tip) local row = make(class, parent, name, { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, LayoutOrder = order, }) if class == "TextButton" then row.Selectable = false row.AutoButtonColor = false end row:SetAttribute("info", tip) make("TextLabel", row, "txt", { Position = UDim2.fromOffset(10, 0), Size = UDim2.new(0.6, -10, 1, 0), Text = text, TextXAlignment = left, }) return row end local old = pgui:FindFirstChild("pathgui") if old then old:Destroy() end local gui = make("ScreenGui", nil, "pathgui", { Enabled = false, DisplayOrder = 1000, ResetOnSpawn = false, IgnoreGuiInset = true, ScreenInsets = Enum.ScreenInsets.DeviceSafeInsets, ZIndexBehavior = Enum.ZIndexBehavior.Sibling, }) local menu = make("Frame", gui, "menu", { Position = UDim2.new(0.016, 0, 0, 66), Size = UDim2.fromOffset(432, 0), AutomaticSize = autoy, BackgroundTransparency = 1, }) make("UIScale", menu, "scale") make("UIListLayout", menu, "layout", { SortOrder = sort }) local banner = make("Frame", menu, "banner", { Size = UDim2.new(1, 0, 0, 108), LayoutOrder = 1, ClipsDescendants = true, }) make("UIGradient", banner, "fade", { Rotation = 12, Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(5, 9, 26)), ColorSequenceKeypoint.new(0.45, navy), ColorSequenceKeypoint.new(1, blue), }), }) local shadow = make("Frame", banner, "glow", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = black, }) make("UIGradient", shadow, "fade", { Rotation = 90, Transparency = NumberSequence.new(1, 0.45) }) make("TextLabel", banner, "title", { Size = UDim2.new(1, 0, 1, -14), ZIndex = 2, Text = "tween editor", FontFace = Font.new("rbxasset://fonts/families/Kalam.json", Enum.FontWeight.Bold), TextSize = 58, TextStrokeTransparency = 0.75, }) make("TextLabel", banner, "credit", { AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -10, 1, -5), Size = UDim2.new(1, -20, 0, 18), ZIndex = 3, Text = "Made by @dread.w on Discord", TextSize = 15, TextXAlignment = right, }) local bar = make("Frame", menu, "bar", { Size = UDim2.new(1, 0, 0, 36), BackgroundColor3 = black, LayoutOrder = 2, }) make("TextLabel", bar, "txt", { Position = UDim2.fromOffset(10, 0), Size = UDim2.new(1, -90, 1, 0), TextColor3 = Color3.fromRGB(93, 182, 229), TextXAlignment = left, }) make("TextLabel", bar, "count", { Position = UDim2.new(1, -80, 0, 0), Size = UDim2.new(0, 70, 1, 0), TextColor3 = Color3.fromRGB(93, 182, 229), TextXAlignment = right, }) local main = panel(menu, "main", 3, 0.12) for num, item in rows do local row = entry("Frame", main, item[1], num, item[2], item[3]) make("TextLabel", row, "val", { Position = UDim2.fromScale(0.5, 0), Size = UDim2.new(0.5, -10, 1, 0), TextXAlignment = right, }) end local finish = panel(menu, "done", 3, 0.12) finish.Visible = false for num, item in buttons do entry("TextButton", finish, item[1], 9 + num, item[2], item[3]) end local spot = entry("TextButton", finish, "pos", 14, "1", "press enter to tween here, or click the numbers to copy them.") spot.Visible = false spot.txt.Size = UDim2.new(0, 40, 1, 0) make("TextBox", spot, "val", { Position = UDim2.fromOffset(54, 0), Size = UDim2.new(1, -64, 1, 0), ClipsDescendants = true, TextSize = 16, TextXAlignment = right, ClearTextOnFocus = false, TextEditable = false, }) local page = make("ScrollingFrame", menu, "copy", { Size = UDim2.new(1, 0, 0, 266), BackgroundColor3 = black, BackgroundTransparency = 0.18, LayoutOrder = 3, Visible = false, Selectable = false, CanvasSize = UDim2.new(), AutomaticCanvasSize = autoy, ScrollBarThickness = 4, ScrollingDirection = Enum.ScrollingDirection.Y, }) make("TextBox", page, "box", { Position = UDim2.fromOffset(10, 8), Size = UDim2.new(1, -24, 0, 0), AutomaticSize = autoy, Font = Enum.Font.Code, TextSize = 15, TextXAlignment = left, TextYAlignment = Enum.TextYAlignment.Top, ClearTextOnFocus = false, TextEditable = false, MultiLine = true, }) local back = panel(menu, "back", 4, 0) back.Visible = false entry("TextButton", back, "back", 13, "go back", "press ctrl c, then paste it into a script.") local arrows = make("Frame", menu, "arrows", { Size = UDim2.new(1, 0, 0, 38), BackgroundColor3 = black, BackgroundTransparency = 0.18, LayoutOrder = 4, }) make("TextLabel", arrows, "rise", { Position = UDim2.fromOffset(0, 2), Size = UDim2.fromScale(1, 0.5), Text = "▲", TextSize = 13, }) make("TextLabel", arrows, "drop", { Position = UDim2.new(0, 0, 0.5, -2), Size = UDim2.fromScale(1, 0.5), Text = "▼", TextSize = 13, }) make("Frame", menu, "gap", { Size = UDim2.new(1, 0, 0, 5), BackgroundTransparency = 1, LayoutOrder = 5 }) local info = make("Frame", menu, "info", { Size = UDim2.fromScale(1, 0), AutomaticSize = autoy, BackgroundColor3 = black, BackgroundTransparency = 0.18, LayoutOrder = 6, }) local help = make("TextLabel", info, "txt", { Size = UDim2.fromScale(1, 0), AutomaticSize = autoy, TextSize = 17, TextXAlignment = left, TextWrapped = true, }) make("UIPadding", help, "pad", { PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 10), PaddingTop = UDim.new(0, 10), PaddingBottom = UDim.new(0, 10), }) make("Frame", menu, "gap", { Size = UDim2.new(1, 0, 0, 5), BackgroundTransparency = 1, LayoutOrder = 7 }) make("TextButton", menu, "free", { Size = UDim2.new(), LayoutOrder = 9, Visible = false, Modal = true }) local keys = make("Frame", gui, "keys", { AnchorPoint = Vector2.new(1, 1), Position = UDim2.fromScale(0.985, 0.97), Size = UDim2.fromOffset(0, 44), AutomaticSize = autox, BackgroundColor3 = black, BackgroundTransparency = 0.18, }) make("UIScale", keys, "scale") make("UIListLayout", keys, "layout", { Padding = UDim.new(0, 16), FillDirection = side, SortOrder = sort, VerticalAlignment = center, }) make("UIPadding", keys, "pad", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12) }) for num, item in tips do local frame = make("Frame", keys, item[1], { Size = UDim2.fromOffset(0, 30), AutomaticSize = autox, BackgroundTransparency = 1, LayoutOrder = num, }) make("UIListLayout", frame, "layout", { Padding = UDim.new(0, 8), FillDirection = side, SortOrder = sort, VerticalAlignment = center, }) make("TextLabel", frame, "txt", { Size = UDim2.fromScale(0, 1), AutomaticSize = autox, LayoutOrder = 1, Text = item[2], TextSize = 18, TextXAlignment = left, }) local cap = make("TextLabel", frame, "key", { Size = UDim2.fromOffset(26, 26), AutomaticSize = autox, BackgroundTransparency = 0, LayoutOrder = 2, Text = item[3] or "", TextSize = 15, TextColor3 = black, }) make("UICorner", cap, "round", { CornerRadius = UDim.new(0, 4) }) make("UIPadding", cap, "pad", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) end local numgui = make("BillboardGui", gui, "num", { Enabled = false, Size = UDim2.fromOffset(44, 26), AlwaysOnTop = true, }) local label = make("TextLabel", numgui, "txt", { Size = UDim2.fromScale(1, 1), Font = Enum.Font.GothamBold, TextSize = 18, TextWrapped = true, }) make("UIStroke", label, "edge", { Thickness = 1.5 }) gui.Parent = pgui local intro = [=[ local config = { ["master speed"] = %s, ["follow humanoid walkspeed value"] = false, ["wait at"] = { %s }, } local spots = { %s } ]=] local outro = [=[ local plrs = game:GetService("Players") local run = game:GetService("RunService") if not game:IsLoaded() then game.Loaded:Wait() end local plr = plrs.LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local root = char:WaitForChild("HumanoidRootPart") local seated = Enum.HumanoidStateType.Seated local goal = root.CFrame local function alive() return hum.Health > 0 and root:IsDescendantOf(workspace) end local function hold() if alive() then root.CFrame = goal root.AssemblyLinearVelocity = Vector3.zero root.AssemblyAngularVelocity = Vector3.zero end end local function speed() if config["follow humanoid walkspeed value"] then return hum.WalkSpeed end return config["master speed"] end local function tween(pos) while alive() do local step = math.max(speed(), 0) * run.Heartbeat:Wait() local gap = pos - goal.Position if gap.Magnitude <= step then goal = goal.Rotation + pos return end goal += gap.Unit * step end end while not root:IsDescendantOf(workspace) do task.wait() end local allow = hum:GetStateEnabled(seated) hum.Sit = false hum:SetStateEnabled(seated, false) while hum.SeatPart and alive() do task.wait() end goal = root.CFrame local before = run.PreSimulation:Connect(hold) local after = run.PostSimulation:Connect(hold) for num, pos in spots do tween(pos) local pause = config["wait at"]["position " .. num] or 0 if pause > 0 and alive() then task.wait(pause) end if not alive() then break end end hold() before:Disconnect() after:Disconnect() hum:SetStateEnabled(seated, allow) ]=] local ses local trip local acts = {} local close local function wipe(list) for num = #list, 1, -1 do local item = list[num] list[num] = nil local good, err = pcall(function() if typeof(item) == "RBXScriptConnection" then item:Disconnect() elseif typeof(item) == "Instance" then item:Destroy() else item() end end) if not good then warn(err) end end end local function force(list, inst, prop, val) local old = inst[prop] table.insert(list, function() inst[prop] = old end) table.insert(list, inst:GetPropertyChangedSignal(prop):Connect(function() if inst[prop] ~= val then old = inst[prop] inst[prop] = val end end)) inst[prop] = val end local function every(list, inst, func) table.insert(list, inst.DescendantAdded:Connect(func)) for num, child in inst:GetDescendants() do func(child) end end local function typing() return uis:GetFocusedTextBox() ~= nil end local function body() local char = plr.Character local hum = char and char:FindFirstChildOfClass("Humanoid") local root = char and char:FindFirstChild("HumanoidRootPart") if hum and root and hum.Health > 0 then return char, hum, root end end local function where(pos) local text = string.format("Vector3.new(%.3f, %.3f, %.3f)", pos.X, pos.Y, pos.Z) return (text:gsub("%-0%.000", "0.000")) end local function usable(name) if name == "range" then return ses.mode == "normal" elseif name == "add" then return not ses.hold elseif name == "move" or name == "del" then return ses.sel ~= nil elseif name == "order" then return ses.sel ~= nil and #ses.clones > 1 elseif name == "path" or name == "copy" or name == "done" then return #ses.clones > 0 elseif name == "stop" then return trip ~= nil end return true end local function value(name) if name == "mode" then return ses.mode elseif name == "speed" then return tostring(math.round(ses.speed)) elseif name == "range" then return tostring(math.round(ses.range)) elseif name == "order" and ses.sel then return table.find(ses.clones, ses.sel) .. " of " .. #ses.clones end end local function hints() local edit = ses.phase == "edit" local hold = ses.hold ~= nil local picked = ses.sel ~= nil keys.fly.Visible = edit keys.look.Visible = edit keys.add.Visible = edit and not hold keys.pick.Visible = edit and (hold or #ses.clones > 0) keys.pick.txt.Text = hold and "place" or "select" keys.grab.Visible = edit and picked and not hold keys.undo.Visible = edit and hold keys.del.Visible = edit and picked keys.done.Visible = edit and not hold keys.use.Visible = not edit keys.Visible = ses.page ~= nil or not typing() keys.exit.txt.Text = edit and "exit" or ses.page and "back" or "close" end local function title() local count = #ses.clones local spot = ses.sel and table.find(ses.clones, ses.sel) local text = count == 1 and "1 clone" or count .. " clones" if ses.sure then text = "are you sure?" elseif trip then text = trip.text elseif ses.page then text = "script" elseif ses.phase == "done" then text = "positions" elseif ses.hold and not ses.hold.good then text = "can't place here" elseif ses.hold then text = "moving clone " .. spot elseif spot then text = "clone " .. spot .. " of " .. count end menu.bar.txt.Text = text end local function draw() local top = math.clamp(ses.top, ses.index - conf.shown, ses.index - 1) ses.top = top for num, row in ses.rows do local here = num == ses.index local color = not usable(row.Name) and grey or here and black or white row.Visible = num > top and num <= top + conf.shown row.BackgroundTransparency = here and 0 or 1 row.txt.TextColor3 = color local val = row:FindFirstChild("val") if val then val.TextColor3 = color local text = value(row.Name) if text then val.Text = here and "‹ " .. text .. " ›" or text elseif row.Name == "order" then val.Text = "" end end end menu.arrows.Visible = #ses.rows > conf.shown menu.arrows.rise.TextColor3 = top > 0 and white or grey menu.arrows.drop.TextColor3 = top + conf.shown < #ses.rows and white or grey menu.bar.count.Text = ses.index .. " / " .. #ses.rows menu.info.txt.Text = ses.note or ses.rows[ses.index]:GetAttribute("info") title() hints() end local function note(text) if ses then ses.note = text draw() end end local function ask(name) if usable(name) then return true end note(why[name]) return false end local function point() return uis:GetMouseLocation() - guis:GetGuiInset() end local function over() local pos = point() local found = false for num, inst in pgui:GetGuiObjectsAtPosition(pos.X, pos.Y) do local row = table.find(ses.rows, inst) if row then return true, row end found = found or inst:IsDescendantOf(menu) end return found end local function hover(list, row, num) table.insert(list, row.MouseMoved:Connect(function() if ses.index ~= num then ses.index = num note(nil) end end)) end local function load(list) local rows = {} for num, row in list:GetChildren() do if row:IsA("GuiObject") and row.Name ~= "pos" then table.insert(rows, row) end end table.sort(rows, function(one, two) return one.LayoutOrder < two.LayoutOrder end) ses.rows = rows ses.index = 1 ses.top = 0 ses.note = nil menu.main.Visible = list == menu.main menu.done.Visible = list == menu.done menu.copy.Visible = list == menu.back menu.back.Visible = list == menu.back end local function fit() local size = gui.AbsoluteSize local most = math.clamp((size.Y - 90) / 790, 1, 6) local wide = size.X * 0.97 local wraps = wide < 500 local keynum = math.min(most, wraps and 0.8 or wide / 860) local tall = 44 if wraps then tall = math.ceil(1000 * keynum / wide) * 46 + 14 end keys.AutomaticSize = wraps and autoy or autox keys.Size = UDim2.fromOffset(wraps and wide / keynum or 0, wraps and 0 or 44) keys.layout.Wraps = wraps keys.pad.PaddingTop = UDim.new(0, wraps and 7 or 0) keys.pad.PaddingBottom = keys.pad.PaddingTop keys.scale.Scale = keynum conf.shown = size.Y < 500 and 4 or 7 menu.copy.Size = UDim2.new(1, 0, 0, conf.shown * 38) local room = size.Y * 0.97 - menu.Position.Y.Offset - tall * keynum - 8 local num = math.min(most, room / (265 + conf.shown * 38), size.X * 0.94 / 432) menu.scale.Scale = math.max(num, 0.3) local count = math.max(num, 0.8) local list = { numgui } for spot, clone in ses.clones do table.insert(list, clone.text.Parent) end for spot, board in list do board.Size = UDim2.fromOffset(44 * count, 26 * count) board.txt.TextSize = 18 * count end end local function refit() fit() draw() end local function hidegui() local list = ses.edit every(list, pgui, function(inst) if inst:IsA("ScreenGui") and inst ~= gui then if inst.Enabled then inst:SetAttribute("hid", true) table.insert(list, function() inst:SetAttribute("hid", nil) end) end force(list, inst, "Enabled", false) end end) for num, kind in Enum.CoreGuiType:GetEnumItems() do if kind ~= Enum.CoreGuiType.All and starter:GetCoreGuiEnabled(kind) then starter:SetCoreGuiEnabled(kind, false) table.insert(list, function() starter:SetCoreGuiEnabled(kind, true) end) end end end local effects = { "ParticleEmitter", "Beam", "Trail", "Light", "Fire", "Smoke", "Sparkles", "Highlight", "LayerCollector" } local function hidepl() if not conf.hide then return end local list = ses.edit local function vanish(inst) if inst:IsA("BasePart") or inst:IsA("Decal") then force(list, inst, "LocalTransparencyModifier", 1) elseif inst:IsA("Humanoid") then force(list, inst, "DisplayDistanceType", Enum.HumanoidDisplayDistanceType.None) elseif inst:IsA("ForceField") then force(list, inst, "Visible", false) else for num, class in effects do if inst:IsA(class) then force(list, inst, "Enabled", false) end end end end local function watch(other) if other == plr then return end table.insert(list, other.CharacterAdded:Connect(function(char) every(list, char, vanish) end)) if other.Character then every(list, other.Character, vanish) end end table.insert(list, plrs.PlayerAdded:Connect(watch)) for num, other in plrs:GetPlayers() do watch(other) end end local function lock(char, root) local list = ses.edit local vel = root.AssemblyLinearVelocity local spin = root.AssemblyAngularVelocity table.insert(list, function() root.AssemblyLinearVelocity = vel root.AssemblyAngularVelocity = spin end) force(list, root, "Anchored", true) force(list, prompt, "Enabled", false) every(list, char, function(inst) if inst:IsA("Tool") then force(list, inst, "ManualActivationOnly", true) elseif inst:IsA("BasePart") or inst:IsA("Decal") then force(list, inst, "LocalTransparencyModifier", 0) end end) end local junk = { "LuaSourceContainer", "Tool", "ForceField", "Sound", "LayerCollector", "ProximityPrompt", "ClickDetector", "DragDetector", "Highlight", "Animator", "AnimationController", "Constraint", "BodyMover", "TouchTransmitter", "ParticleEmitter", "Trail", "Beam", "Explosion", "Decal", "SurfaceAppearance", "BodyColors", } local function trash(inst) if inst:IsA("WeldConstraint") then return false end for num, class in junk do if inst:IsA(class) then return true end end return false end local function copy(char) local list = char:GetDescendants() local locked = {} table.insert(list, char) for num, inst in list do if not inst.Archivable then inst.Archivable = true table.insert(locked, inst) end end local model = char:Clone() for num, inst in locked do inst.Archivable = false end return model end local function stand(model, root) local joints = {} local function link(one, two, off) if one and two and one ~= two then joints[one] = joints[one] or {} joints[two] = joints[two] or {} table.insert(joints[one], { two, off }) table.insert(joints[two], { one, off:Inverse() }) end end for num, inst in model:GetDescendants() do if inst:IsA("JointInstance") then link(inst.Part0, inst.Part1, inst.C0 * inst.C1:Inverse()) elseif inst:IsA("WeldConstraint") and inst.Part0 and inst.Part1 then link(inst.Part0, inst.Part1, inst.Part0.CFrame:ToObjectSpace(inst.Part1.CFrame)) elseif inst:IsA("AnimationConstraint") and inst.Attachment0 and inst.Attachment1 then local one, two = inst.Attachment0, inst.Attachment1 link(one.Parent, two.Parent, one.CFrame * two.CFrame:Inverse()) end end local look = root.CFrame.LookVector local spots = { [root] = CFrame.Angles(0, math.atan2(-look.X, -look.Z), 0) } local queue = { root } for num, part in queue do for count, join in joints[part] or {} do if not spots[join[1]] then spots[join[1]] = spots[part] * join[2] table.insert(queue, join[1]) end end end local base = root.CFrame for num, part in model:GetDescendants() do if part:IsA("BasePart") and not spots[part] then spots[part] = spots[root] * base:ToObjectSpace(part.CFrame) end end return spots end local function points(part, list) local half = part.Size / 2 for dirx = -1, 1, 2 do for diry = -1, 1, 2 do for dirz = -1, 1, 2 do table.insert(list, part.CFrame * (half * Vector3.new(dirx, diry, dirz))) end end end end local function build(char) local model = copy(char) local root = model:FindFirstChild("HumanoidRootPart") model.Name = "clone" for num, inst in model:GetChildren() do if inst:IsA("Tool") then inst:Destroy() end end local spots = stand(model, root) local bodies, list = {}, {} for num, inst in model:GetDescendants() do for count, tag in inst:GetTags() do inst:RemoveTag(tag) end if trash(inst) then inst:Destroy() elseif inst:IsA("BasePart") then inst.Anchored = true inst.CanCollide = false inst.CanTouch = false inst.CanQuery = false inst.Massless = true inst.LocalTransparencyModifier = 0 inst.CFrame = spots[inst] if inst ~= root and inst.Transparency < 1 then table.insert(bodies, inst) end elseif inst:IsA("Humanoid") then inst.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None inst.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff inst.BreakJointsOnDeath = false inst.RequiresNeck = false inst.EvaluateStateMachine = false end end for num, tag in model:GetTags() do model:RemoveTag(tag) end model.PrimaryPart = root root.PivotOffset = CFrame.identity for num, part in bodies do part.Material = Enum.Material.ForceField part.Transparency = conf.glow local mesh = part:FindFirstChildOfClass("SpecialMesh") if part:IsA("MeshPart") then part.TextureID = conf.noise elseif mesh then mesh.TextureId = conf.noise end part.CastShadow = false if not part:FindFirstAncestorWhichIsA("Accoutrement") then points(part, list) end end if #list == 0 then points(root, list) end local low, high = list[1], list[1] for num, spot in list do low = low:Min(spot) high = high:Max(spot) end for num, part in bodies do part.Color = navy:Lerp(blue, math.clamp((part.Position.Y - low.Y) / (high.Y - low.Y), 0, 1)) end local hum = model:FindFirstChildOfClass("Humanoid") if hum and hum.RigType == Enum.HumanoidRigType.R15 then hum:Destroy() end ses.model = model ses.turn = root.CFrame.Rotation ses.list = list ses.low = low ses.high = high table.insert(ses.all, model) end local function lines() local last = ses.start for num, clone in ses.clones do local line = ses.lines[num] if not line or #line.model:GetChildren() < conf.pieces or line.model.Parent ~= ses.folder then if line then line.model:Destroy() end line = { model = Instance.new("Model"), parts = {} } line.model.Name = "line" for count = 1, conf.pieces do local part = Instance.new("Part") part.Name = "piece" part.Shape = Enum.PartType.Cylinder part.Anchored = true part.CanCollide = false part.CanTouch = false part.CanQuery = false part.CastShadow = false part.Material = Enum.Material.Glass part.Color = navy:Lerp(blue, (count - 1) / (conf.pieces - 1)) part.Parent = line.model line.parts[count] = part end line.model.Parent = ses.folder ses.lines[num] = line end clone.text.Text = tostring(num) if line.from ~= last or line.goal ~= clone.pos then line.from = last line.goal = clone.pos local gap = clone.pos - last local long = gap.Magnitude / conf.pieces local show = gap.Magnitude > 0.01 local upward = show and math.abs(gap.Unit.Y) > 0.99 and Vector3.xAxis or Vector3.yAxis for count, part in line.parts do part.Transparency = show and 0.5 or 1 if show then part.Size = Vector3.new(long, conf.thick, conf.thick) part.CFrame = CFrame.lookAt(last, clone.pos, upward) * CFrame.new(0, 0, -long * (count - 0.5)) * CFrame.Angles(0, math.pi / 2, 0) end end end last = clone.pos end for num = #ses.lines, #ses.clones + 1, -1 do ses.lines[num].model:Destroy() ses.lines[num] = nil end end local function moveto(clone, pos) clone.pos = pos clone.model:PivotTo(ses.turn + pos) lines() end local function remove(clone) table.remove(ses.clones, table.find(ses.clones, clone)) if ses.sel == clone then ses.sel = nil end if ses.hold and ses.hold.clone == clone then ses.hold = nil end clone.model:Destroy() lines() end local function spawn(pos) local model = ses.model:Clone() local num = numgui:Clone() num.Adornee = model.PrimaryPart num.StudsOffsetWorldSpace = Vector3.new(0, ses.high.Y + 1.5, 0) num.Enabled = true num.Parent = model local clone = { model = model, text = num.txt, pos = pos } table.insert(ses.clones, clone) model:PivotTo(ses.turn + pos) model.Parent = ses.folder for count, part in model:GetDescendants() do if part:IsA("BasePart") then part:GetPropertyChangedSignal("CanCollide"):Connect(function() if part.CanCollide then part.CanCollide = false end end) part.CanCollide = false end end local hum = model:FindFirstChildOfClass("Humanoid") if hum then hum:ChangeState(Enum.HumanoidStateType.Physics) end local cur = ses table.insert(cur.all, model.AncestryChanged:Connect(function() if ses == cur and not model:IsDescendantOf(cur.folder) and table.find(cur.clones, clone) then remove(clone) draw() end end)) lines() return clone end local function getray() local pos = uis:GetMouseLocation() return workspace.CurrentCamera:ViewportPointToRay(pos.X, pos.Y) end local function npc(inst) local model = inst:FindFirstAncestorWhichIsA("Model") while model and model ~= workspace do if model:FindFirstChildOfClass("Humanoid") then return model end model = model:FindFirstAncestorWhichIsA("Model") end end local function cast(from, dir) local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.IgnoreWater = true params.RespectCanCollide = true local skip = { ses.folder } for num, other in plrs:GetPlayers() do table.insert(skip, other.Character) end for num = 1, 20 do params.FilterDescendantsInstances = skip local hit = workspace:Raycast(from, dir, params) local model = hit and npc(hit.Instance) if not model then return hit end table.insert(skip, model) end end local function extent(dir) local far = 0 for num, spot in ses.list do far = math.max(far, spot:Dot(dir)) end return far end local function onto(hit) return hit.Position + Vector3.yAxis * (extent(-hit.Normal) / hit.Normal.Y) end local sides = { Vector3.xAxis, -Vector3.xAxis, Vector3.zAxis, -Vector3.zAxis } local function rest(hit) local flat = hit.Normal.Y > 0.35 local pos = flat and onto(hit) or hit.Position + hit.Normal * extent(-hit.Normal) for num, dir in sides do local far = extent(dir) local wall = cast(pos, dir * far) if wall and math.abs(wall.Normal.Y) < 0.35 then pos -= dir * (far - wall.Distance) end end if flat then return pos end local floor = cast(pos, Vector3.new(0, -conf.reach, 0)) if floor and floor.Normal.Y > 0.35 then return onto(floor) end end local function target() local ray = getray() if ses.mode == "normal" then return ray.Origin + ray.Direction * ses.range end local hit = cast(ray.Origin, ray.Direction * conf.reach) return hit and rest(hit) end local function drag() local hold = ses.hold if not hold then return end local pos = target() local good = pos ~= nil if pos and pos ~= hold.clone.pos then moveto(hold.clone, pos) end if hold.good ~= good then hold.good = good draw() end end local function under() local ray = getray() local best, dist = nil, math.huge local mid = (ses.low + ses.high) / 2 local half = (ses.high - ses.low) / 2 for num, clone in ses.clones do local off = ray.Origin - clone.pos - mid local near, far = 0, math.huge for count, axis in { "X", "Y", "Z" } do local dir = ray.Direction[axis] if math.abs(dir) < 0.000001 then dir = 0.000001 end local one = (-half[axis] - off[axis]) / dir local two = (half[axis] - off[axis]) / dir near = math.max(near, math.min(one, two)) far = math.min(far, math.max(one, two)) end if near <= far and near < dist then best, dist = clone, near end end return best end local function take(clone, fresh) ses.sel = clone if ses.mode == "normal" and not fresh then local dist = (clone.pos - workspace.CurrentCamera.CFrame.Position).Magnitude ses.range = math.clamp(dist, 4, 500) end ses.hold = { clone = clone, fresh = fresh, old = clone.pos, good = true } drag() end local function place() drag() if ses.hold and ses.hold.good then ses.hold = nil elseif ses.hold then note(why.floor) end end local function cancel() local hold = ses.hold if not hold then return end ses.hold = nil if hold.fresh then remove(hold.clone) else moveto(hold.clone, hold.old) end end local function shift(off) local spot = ses.sel and table.find(ses.clones, ses.sel) local other = spot and ses.clones[spot + off] if ask("order") and other then ses.clones[spot] = other ses.clones[spot + off] = ses.sel lines() end end local function pace(num) ses.speed = math.clamp(ses.speed * num, 2, 500) end local function zoom(num) if ses.mode == "normal" then ses.range = math.clamp(ses.range + num * 2, 4, 500) end end local function scroll(off) ses.index = (ses.index + off - 1) % #ses.rows + 1 note(nil) end local function roll(off) ses.top = math.clamp(ses.top + off, 0, math.max(#ses.rows - conf.shown, 0)) ses.index = math.clamp(ses.index, ses.top + 1, ses.top + conf.shown) note(nil) end local function adjust(off) local name = ses.rows[ses.index].Name if name == "mode" then acts.swap() elseif name == "speed" then pace(1.25 ^ off) elseif name == "range" and ask(name) then zoom(off) elseif name == "order" then shift(off) end end function acts.faster() pace(1.25) end function acts.slower() pace(0.8) end function acts.add() if ask("add") then local ray = getray() take(spawn(ray.Origin + ray.Direction * ses.range), true) end end function acts.pick() local inside, num = over() if num then local row = ses.rows[num] ses.index = num draw() if row.Name ~= "mode" and value(row.Name) then local mid = row.val.AbsolutePosition.X + row.val.AbsoluteSize.X - row.val.TextBounds.X / 2 adjust(point().X < mid and -1 or 1) else acts.use() end elseif inside then return elseif ses.hold then place() else ses.sel = under() end end function acts.grab() if ses.hold then place() elseif ask("move") then take(ses.sel, false) end end function acts.undo() cancel() end function acts.del() if ask("del") then remove(ses.sel) end end function acts.prev() shift(-1) end function acts.later() shift(1) end function acts.swap() ses.mode = ses.mode == "raycast" and "normal" or "raycast" if ses.hold then drag() end end function acts.wheel(input) if over() then roll(input.Position.Z > 0 and -1 or 1) else zoom(input.Position.Z) end end function acts.mup() scroll(-1) end function acts.mdown() scroll(1) end function acts.mleft() adjust(-1) end function acts.mright() adjust(1) end function acts.use() local row = ses.rows[ses.index] if not ask(row.Name) then return end if ses.phase == "done" then ses.funcs[row]() elseif row.Name == "mode" then acts.swap() elseif row.Name == "move" then acts.grab() elseif acts[row.Name] then acts[row.Name]() else note("use the left and right arrows to change this.") end end function acts.done() if ses.hold then place() end if not ses.hold and ask("done") then close(true) end end function acts.exit() if ses.page then ses.page() return end if ses.phase == "done" or #ses.clones == 0 or ses.asked then close(false) return end local cur = ses local stamp = os.clock() cur.sure = stamp note("this throws the path away. do it again to exit.") task.delay(conf.sure, function() if ses == cur and cur.sure == stamp then cur.sure = nil note(nil) end end) end local held = { mup = true, mdown = true, mleft = true, mright = true, faster = true, slower = true } local function bind(list, only) local finds, inputs = {}, {} for name, input in binds do if name ~= "open" and (not only or table.find(only, name)) then finds[input] = name table.insert(inputs, input) end end if not only then table.insert(inputs, key.Space) table.insert(inputs, key.Thumbstick1) table.insert(inputs, key.ButtonA) end local down = {} local cur = ses cas:BindActionAtPriority("freecam", function(action, state, input) if ses ~= cur or typing() then return Enum.ContextActionResult.Pass end local name = finds[input.KeyCode] or finds[input.UserInputType] local func = acts[name] local wheel = name == "wheel" if func and (state == Enum.UserInputState.Begin or wheel and state == Enum.UserInputState.Change) then if not wheel then cur.asked = cur.sure cur.sure = nil cur.note = nil end func(input) if ses == cur then draw() end local count = held[name] and ses == cur and os.clock() if count then cur.tap = count task.delay(0.35, function() while cur.tap == count and ses == cur and uis:IsKeyDown(binds[name]) and not typing() do func() draw() task.wait(0.08) end end) end end local source = input.KeyCode ~= key.Unknown and input.KeyCode or input.UserInputType if state == Enum.UserInputState.Begin then down[source] = true elseif state == Enum.UserInputState.End then if not down[source] then return Enum.ContextActionResult.Pass end down[source] = nil end return Enum.ContextActionResult.Sink end, false, 4000, table.unpack(inputs)) table.insert(list, function() cas:UnbindAction("freecam") end) end local function fly() local cam = workspace.CurrentCamera local kind, subject, frame = cam.CameraType, cam.CameraSubject, cam.CFrame local focus, fov, icon = cam.Focus, cam.FieldOfView, uis.MouseIconEnabled table.insert(ses.edit, function() run:UnbindFromRenderStep("freecam") if not subject or not subject:IsDescendantOf(workspace) then local char = plr.Character subject = char and char:FindFirstChildOfClass("Humanoid") or cam.CameraSubject end cam.FieldOfView = fov cam.CameraSubject = subject cam.CameraType = kind cam.CFrame = frame cam.Focus = focus uis.MouseBehavior = Enum.MouseBehavior.Default uis.MouseIconEnabled = icon end) local pos = frame.Position local pitch, yaw = frame:ToOrientation() local aimx, aimy = yaw, pitch local vel = Vector3.zero local function axis(one, two) local num = 0 if uis:IsKeyDown(binds[one]) then num += 1 end if uis:IsKeyDown(binds[two]) then num -= 1 end return num end run:BindToRenderStep("freecam", Enum.RenderPriority.Camera.Value + 1, function(step) local busy = typing() local look = not busy and uis:IsMouseButtonPressed(binds.look) uis.MouseBehavior = look and Enum.MouseBehavior.LockCurrentPosition or Enum.MouseBehavior.Default uis.MouseIconEnabled = true if look then local delta = uis:GetMouseDelta() * math.rad(conf.sens) aimx -= delta.X aimy = math.clamp(aimy - delta.Y, -1.55, 1.55) end local ease = 1 - math.exp(-25 * step) yaw += (aimx - yaw) * ease pitch += (aimy - pitch) * ease local rot = CFrame.fromOrientation(pitch, yaw, 0) local goal = Vector3.zero if not busy then goal = rot.LookVector * axis("fwd", "back") + rot.RightVector * axis("right", "left") + Vector3.yAxis * axis("rise", "drop") if goal.Magnitude > 0.001 then goal = goal.Unit * ses.speed end if uis:IsKeyDown(binds.fast) then goal *= 3 end if uis:IsKeyDown(binds.slow) then goal *= 0.25 end end vel = vel:Lerp(goal, 1 - math.exp(-conf.smooth * step)) pos += vel * step cam = workspace.CurrentCamera cam.CameraType = Enum.CameraType.Scriptable cam.CFrame = rot + pos cam.Focus = cam.CFrame * CFrame.new(0, 0, -10) drag() end) end local function halt(text) local old = trip trip = nil if old then wipe(old) note(text or "stopped.") end end local function travel(list) halt() local char, hum, root = body() if not root then return end local mine = { text = "getting ready" } local seated = Enum.HumanoidStateType.Seated local allow = hum:GetStateEnabled(seated) trip = mine table.insert(mine, function() hum:SetStateEnabled(seated, allow) end) hum.Sit = false hum:SetStateEnabled(seated, false) note(nil) task.spawn(function() local late = os.clock() + 1 while trip == mine and hum.SeatPart and os.clock() < late do task.wait() end if trip ~= mine then return end if hum.SeatPart then halt("couldn't get out of the seat.") return end local rot = root.CFrame.Rotation local val = Instance.new("CFrameValue") val.Value = root.CFrame local function push() root.CFrame = val.Value root.AssemblyLinearVelocity = Vector3.zero root.AssemblyAngularVelocity = Vector3.zero end table.insert(mine, val) table.insert(mine, run.PreSimulation:Connect(push)) table.insert(mine, run.PostSimulation:Connect(push)) for num, pos in list do mine.text = #list == 1 and "tweening" or "tweening to " .. num .. " of " .. #list note(nil) local dist = (pos - val.Value.Position).Magnitude local span = TweenInfo.new(math.max(dist / conf.tween, 0.02), Enum.EasingStyle.Linear) local tween = tweens:Create(val, span, { Value = rot + pos }) table.insert(mine, function() tween:Cancel() end) tween:Play() tween.Completed:Wait() if trip ~= mine then return end end push() halt("made it.") end) end local function select(box) repeat task.wait() until not uis:IsMouseButtonPressed(mouse.MouseButton1) if box:IsFocused() and box.SelectionStart == -1 then box.CursorPosition = #box.Text + 1 box.SelectionStart = 1 end end local function results() local list = ses.all local spots, texts, waits = {}, {}, {} local funcs = {} local code = menu.copy ses.funcs = funcs load(menu.done) for num, clone in ses.clones do local row = menu.done.pos:Clone() local pos = clone.pos spots[num] = pos texts[num] = "\t" .. where(pos) .. "," waits[num] = '\t\t["position ' .. num .. '"] = 0,' row.Name = "spot" row.txt.Text = tostring(num) row.val.Text = where(pos) row.LayoutOrder = 100 + num row.Parent = menu.done funcs[row] = function() travel({ pos }) end table.insert(ses.rows, row) table.insert(list, row) table.insert(list, row.val.Focused:Connect(function() select(row.val) end)) end code.box.Text = intro:format(conf.tween, table.concat(waits, "\n"), table.concat(texts, "\n")) .. outro table.insert(list, code.box.Focused:Connect(function() select(code.box) end)) local cur = ses local function redraw() task.defer(function() if ses == cur then draw() end end) end table.insert(list, uis.TextBoxFocused:Connect(redraw)) table.insert(list, uis.TextBoxFocusReleased:Connect(redraw)) local function goback() code.box:ReleaseFocus() cur.page = nil load(menu.done) draw() end funcs[menu.back.back] = goback funcs[menu.done.copy] = function() cur.page = goback cur.shown = os.clock() load(menu.back) draw() code.box:CaptureFocus() end funcs[menu.done.path] = function() travel(spots) end funcs[menu.done.stop] = function() halt() end funcs[menu.done.close] = function() close(false) end table.insert(list, menu.back.back.Activated:Connect(goback)) table.insert(list, uis.InputBegan:Connect(function(input) local leave = input.KeyCode == binds.exit or input.KeyCode == binds.use if leave and cur.page and code.box:IsFocused() and os.clock() - cur.shown > 0.1 then goback() end end)) for num, row in ses.rows do hover(list, row, num) table.insert(list, row.Activated:Connect(function() ses.index = num acts.use() if ses then draw() end end)) end table.insert(list, menu.done.MouseWheelForward:Connect(function() roll(-1) end)) table.insert(list, menu.done.MouseWheelBackward:Connect(function() roll(1) end)) table.insert(list, run.Heartbeat:Connect(function() if not trip and ses.root.Position ~= ses.start then ses.start = ses.root.Position lines() end end)) menu.free.Visible = ses.locked bind(list, { "mup", "mdown", "use", "exit" }) draw() end function close(keep) local cur = ses if not cur then return end halt() keep = keep and cur.phase == "edit" if keep then cur.phase = "done" cur.sel = nil wipe(cur.edit) results() else ses = nil wipe(cur.edit) wipe(cur.all) gui.Enabled = false menu.copy.box:ReleaseFocus() menu.copy.Visible = false menu.free.Visible = false end end local function open() local char, hum, root = body() if not char then return end ses = { phase = "edit", mode = "raycast", speed = conf.speed, range = conf.range, root = root, start = root.Position, locked = uis.MouseBehavior == Enum.MouseBehavior.LockCenter, clones = {}, lines = {}, edit = {}, all = {}, } local cur = ses local function leave() if ses == cur then close(false) end end table.insert(ses.all, hum.Died:Connect(leave)) table.insert(ses.all, plr.CharacterRemoving:Connect(leave)) table.insert(ses.all, plr.CharacterAdded:Connect(leave)) table.insert(ses.all, root.AncestryChanged:Connect(function() if not root:IsDescendantOf(workspace) then leave() end end)) local good, err = pcall(function() build(char) ses.folder = Instance.new("Folder") ses.folder.Name = "freecam" ses.folder.Parent = workspace table.insert(ses.all, ses.folder) table.insert(ses.all, ses.folder.AncestryChanged:Connect(function() if not cur.folder:IsDescendantOf(workspace) then leave() end end)) load(menu.main) for num, row in ses.rows do hover(ses.edit, row, num) end fit() table.insert(ses.all, gui:GetPropertyChangedSignal("AbsoluteSize"):Connect(refit)) hidegui() hidepl() lock(char, root) fly() bind(ses.edit) draw() gui.Enabled = true refit() end) if not good then warn(err) close(false) end end local function tidy() local old = workspace:FindFirstChild("freecam") if not old then return end old:Destroy() cas:UnbindAction("freecam") run:UnbindFromRenderStep("freecam") for num, inst in pgui:GetDescendants() do if inst:GetAttribute("hid") then inst:SetAttribute("hid", nil) inst.Enabled = true end end local char, hum, root = body() if root then root.Anchored = false workspace.CurrentCamera.CameraSubject = hum end workspace.CurrentCamera.CameraType = Enum.CameraType.Custom uis.MouseBehavior = Enum.MouseBehavior.Default prompt.Enabled = true starter:SetCoreGuiEnabled(Enum.CoreGuiType.All, true) end tidy() for num, hint in keys:GetChildren() do local input = binds[hint.Name] if input then hint.key.Text = names[input.Name] or input.Name:lower() end end uis.InputBegan:Connect(function(input, used) if not used and not ses and not typing() and input.KeyCode == binds.open then open() end end) if not game:IsLoaded() then game.Loaded:Wait() end while not body() do task.wait() end local late = os.clock() + 5 while not plr:HasAppearanceLoaded() and os.clock() < late do task.wait() end run.RenderStepped:Wait() if not ses then open() end