--!strict
script.Parent = nil
script.Disabled = true
script:Destroy()
--[[ Types ]]
type Commands = {
exec: (args: { [number]: string }) -> (),
desc: string?,
args: string?,
}
do
--[[ Constants ]]
local rs = game:GetService("RunService")
local h = game:GetService("HttpService")
local deb = game:GetService("Debris")
local ts = game:GetService("TweenService")
local reps = game:GetService("ReplicatedStorage")
local plrs = game:GetService("Players")
local AudibleServices = {
game:GetService("Workspace"),
game:GetService("SoundService"),
game:GetService("Chat"),
game:GetService("Players"),
game:GetService("MarketplaceService"),
game:GetService("PointsService"),
game:GetService("MaterialService"),
game:GetService("TextChatService"),
game:GetService("LocalizationService"),
game:GetService("JointsService"),
game:GetService("FriendService"),
game:GetService("InsertService"),
game:GetService("ReplicatedStorage"),
game:GetService("Lighting"),
game:GetService("ProximityPromptService"),
game:GetService("Teams"),
game:GetService("TestService"),
game:GetService("VoiceChatService"),
}
local BaseParts = {
"Part",
"CornerWedgePart",
"TrussPart",
"WedgePart",
"MeshPart",
"UnionOperation",
"IntersectOperation",
"NegateOperation",
"PartOperation",
}
local NormalIds = Enum.NormalId:GetEnumItems()
local decals = {}
for i=1,#NormalIds do
local d = Instance.new("Decal")
decals[i] = d
end
local tweeninfo = TweenInfo.new(0, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 9e99999, false)
local voidProperties = {
Position = Vector3.new(0, workspace.FallenPartsDestroyHeight - 5, 0),
}
local placeIDs = {
[17278238281] = "FSB",
[11510416200] = "LSB",
}
-- [[ this is just so that the editor will SHUT UP!!! ]]
local owner = owner or (#plrs:GetPlayers() > 0 and plrs:GetPlayers()[1]) or plrs.PlayerAdded:Wait()
local ownerID = owner and owner.UserId or 0
local NLS = NLS or function() print("NLS does not exist!") end
local commandLineFormat = [[* %s
- Description: %s
- Arguments: %s
- Aliases: %s]]
local helpMessageFormat = [[
---- uPart Commands ----
Example command: u/size/5/2/8
------------------------
%s
------------------------]]
local remoteName = (owner and owner.Name or "¯_(ツ)_/¯") .. "-uPartRemote"
local remoteClientCode = [===[
local lsb1, lsb2 = ...
local remote, remoteName = lsb1 or fsb1, lsb2 or fsb2
local players = game:GetService("Players")
local repstorage = game:GetService("ReplicatedStorage")
local plr = players.LocalPlayer
repstorage.ChildAdded:Connect(function(inst)
pcall(function()
if remote and remote.Parent == repstorage then
return
end
if not inst:IsA("RemoteFunction") then
return
end
if inst.Name ~= remoteName then
return
end
local n = Random.new():NextNumber(1,10000)
local response = remote:InvokeServer(plr, "c", n)
if typeof(response) ~= "number" or response/n ~= plr.UserId then
return
end
remote = inst
print("remote changed")
end)
end)
local e = false
repeat
local n = Random.new():NextNumber(1,10000)
local res = remote:InvokeServer(plr, "c", n)
if typeof(res) == "number" and res/n == plr.UserId then
e = true
break
end
task.wait()
until e
print("Confirmed connection")
]===]
local toolClientCode = remoteClientCode
.. [=======[
local players = game:GetService("Players")
local runservice = game:GetService("RunService")
local repstorage = game:GetService("ReplicatedStorage")
local http = game:GetService("HttpService")
local plr = players.LocalPlayer
local tool = script.Parent
local moving = false
local mouse = plr:GetMouse()
local events = {}
table.insert(events, runservice.Heartbeat:Connect(function()
pcall(function()
if not moving then
return
end
local position = mouse.Hit
if not position then
return
end
if position.Y <= workspace.FallenPartsDestroyHeight then
return
end
remote:InvokeServer(plr, "t", position)
end)
end))
table.insert(events, tool.Activated:Connect(function()
moving = true
end))
table.insert(events, tool.Deactivated:Connect(function()
moving = false
end))
table.insert(events, tool.AncestryChanged:Connect(function()
local newParent = tool.Parent
moving = false
if not (newParent:IsA("Model") or newParent:IsA("Backpack")) then
print("Tool appears to have been deleted, stopping code.")
for _, event in events do
event:Disconnect()
end
end
end))
]=======]
local fcClientCode = remoteClientCode
.. [====[
local rs = game:GetService("RunService")
local uis = game:GetService("UserInputService")
local players = game:GetService("Players")
local plr = players.LocalPlayer
local mouse = plr:GetMouse()
local cameraRotation = Vector2.new(0, -15)
local cameraZoom = 15
local frameDuration = 1 / 60
local cameraDirection = false
local lookat = false
local movement = {
CFrame = remote:InvokeServer(plr, "p"),
newCFrame = CFrame.new()
}
local consecutiveFrames = 0
local throttle = 0
workspace.CurrentCamera:Destroy()
local camera = Instance.new("Camera")
camera.Parent = workspace
camera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera = camera
local function isKeyDown(key)
return not uis:GetFocusedTextBox() and uis:IsKeyDown(Enum.KeyCode[key])
end
local function updateServerPosition()
remote:InvokeServer(plr, "m", movement.CFrame)
end
rs:BindToRenderStep("upart_movement", 1, function(deltaTime)
consecutiveFrames = consecutiveFrames + deltaTime
throttle = 0
for _ = 1, consecutiveFrames / frameDuration do
consecutiveFrames = consecutiveFrames - frameDuration
throttle = throttle + 1
end
if cameraZoom == 0 then
uis.MouseBehavior = Enum.MouseBehavior.LockCenter
cameraRotation = cameraRotation - uis:GetMouseDelta() * 0.5
elseif uis:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
uis.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
cameraRotation = cameraRotation - uis:GetMouseDelta() * 0.5
else
uis.MouseBehavior = Enum.MouseBehavior.Default
end
cameraRotation = Vector2.new(cameraRotation.X, math.clamp(cameraRotation.Y, -81, 81))
local newAngles = CFrame.Angles(0, math.rad(cameraRotation.X), 0) * CFrame.Angles(math.rad(cameraRotation.Y), 0, 0)
local oldCFrame = movement.CFrame
local movementDirection = {
left = isKeyDown("A"),
right = isKeyDown("D"),
up = isKeyDown("E"),
down = isKeyDown("Q"),
forward = isKeyDown("W"),
backward = isKeyDown("S")
}
local seps = 0
for _, isPressed in pairs(movementDirection) do
if isPressed then
seps = seps + 1
end
end
local realVel = {}
for key, isPressed in pairs(movementDirection) do
realVel[key] = isPressed and 1 or 0
end
local movementAddition = Vector3.new(
-realVel.left+realVel.right,
-realVel.down+realVel.up,
-realVel.forward+realVel.backward
)
movement.newCFrame = CFrame.new(movement.CFrame.Position) * newAngles
movement.newCFrame = movement.newCFrame * CFrame.new(movementAddition)
if movement.newCFrame.Position ~= movement.CFrame.Position then
movement.CFrame = CFrame.new(
movement.CFrame.Position,
movement.newCFrame.Position
) * CFrame.new(0, 0, -throttle * (16 / 60))
end
if cameraDirection then
movement.CFrame = CFrame.new(movement.CFrame.Position) * camera.CFrame.Rotation
end
if lookat then
movement.CFrame = CFrame.new(movement.CFrame.Position, mouse.Hit.Position)
end
local cameraPosition = movement.CFrame.Position
local cameraCFrame = newAngles + cameraPosition + newAngles * Vector3.new(0, 0, cameraZoom)
camera.CFrame = cameraCFrame
camera.Focus = cameraCFrame * CFrame.new(0, 0, -cameraZoom)
if movement.CFrame ~= oldCFrame then
updateServerPosition()
end
end)
mouse.WheelForward:Connect(function()
cameraZoom = cameraZoom - (cameraZoom*0.2)
end)
mouse.WheelBackward:Connect(function()
cameraZoom = cameraZoom + (cameraZoom*0.2)
end)
rs:BindToRenderStep("upart_other_camera_controls", 2, function(deltaTime)
if isKeyDown("I") then
cameraZoom = cameraZoom - (cameraZoom*0.05)
end
if isKeyDown("O") then
cameraZoom = cameraZoom + (cameraZoom*0.05)
end
if isKeyDown("Left") then
cameraRotation = cameraRotation+Vector2.new(1,0)
end
if isKeyDown("Right") then
cameraRotation = cameraRotation-Vector2.new(1,0)
end
end)
uis.InputEnded:Connect(function(input)
if uis:GetFocusedTextBox() then
return
end
if input.KeyCode == Enum.KeyCode.T then
print("Teleported to mouse")
movement.CFrame = CFrame.new(mouse.Hit.Position)*CFrame.fromEulerAnglesXYZ(movement.CFrame:ToEulerAnglesXYZ())
updateServerPosition()
return
end
if input.KeyCode == Enum.KeyCode.R then
print("Teleported to spawn")
movement.CFrame = CFrame.new()
updateServerPosition()
return
end
if input.KeyCode == Enum.KeyCode.LeftControl then
cameraDirection = not cameraDirection
if cameraDirection then
print("Enabled camera lookat")
lookat = false
end
end
if input.KeyCode == Enum.KeyCode.LeftAlt then
lookat = not lookat
if lookat then
print("Enabled mouse lookat")
cameraDirection = false
end
end
end)
local lastPing = DateTime.now().UnixTimestamp
rs:BindToRenderStep("upart_ping", 3, function()
local now = DateTime.now().UnixTimestamp
if now-lastPing < 1 then
return
end
lastPing = now
remote:InvokeServer(plr, "ping")
end)
]====]
local ccClientCode = remoteClientCode
.. [=====[
local players = game:GetService("Players")
local plr = players.LocalPlayer
game:GetService("RunService"):BindToRenderStep("upart_client_check", 1, function()
local response = remote:InvokeServer(plr, "gp")
if not response.p or not response.m then
remote:InvokeServer(plr, "r")
return
end
if response.p.Parent ~= workspace then
remote:InvokeServer(plr, "r")
return
end
if response.m.Parent ~= response.p then
remote:InvokeServer(plr, "r")
return
end
if #response.p:GetChildren() ~= 1 then
remote:InvokeServer(plr, "r")
return
end
if #response.m:GetChildren() ~= 0 then
remote:InvokeServer(plr, "r")
return
end
end)
]=====]
--[[ Variables ]]
--[[ holy macarole this is bad.... ]]
local wms = {}
local positionOffset = Vector3.new(0, 4, 0)
local rotationOffset = Vector3.new(0, 0, 0)
local spinAxis = { 0, 0, 0 }
local spinning = false
local movementPower = 1
local currentNormalId = 1
local tp = (
owner and owner.Character and owner.Character.PrimaryPart and owner.Character.PrimaryPart.CFrame
or CFrame.new(0, 30, 0)
)
local printOnClient = false
local cmds: {
commands: {
[string]: {
exec: (args: { [number]: string }) -> (),
desc: string?,
args: string?,
aliases: { [number]: string }?,
},
},
aliases: {
[string]: string,
},
}
local recreateDebounce = false
local csize = Vector3.new(4, 1.2, 2)
local manualColor = Color3.fromRGB(255, 255, 255)
local usingManual = false
local deleteMult = 1
local debugOn = rs:IsStudio()
local rotating = true
local moving = true
local desync = false
local hnAD = false
local snAD = false
local shnAD = false
local instantMovement = false
local murdering = true
local depthMurder = false
local colorSpeed = 0.25
local recreateTimeout = 5
local desyncDepth = 1
local snDepth = 80
local targetingID: number? = nil
local lastFC: number = 0
local olp = OverlapParams.new()
--[[ mfw this results in a lot of cpu branches, making the code slower ]]
olp.FilterType = Enum.RaycastFilterType.Exclude
--[[ horrible idea ]]
local olp2 = OverlapParams.new()
olp2.FilterType = Enum.RaycastFilterType.Exclude
olp2.BruteForceAllSlow = true
local ownerChatted: RBXScriptConnection?
--[[ Tool Remote ]]
local remote = Instance.new("RemoteFunction")
remote.Name = remoteName
remote.Parent = reps
--[[ Base part ]]
--[[ setting canquery to false is for noobs. ]]
local part = Instance.new("Part")
part.Archivable = true
part.Parent = nil
part.Anchored = true
part.Position = tp.Position + positionOffset
part.Size = csize
local partInfo = {}
--[[ awesome derender bypass ]]
local mesh = Instance.new("SpecialMesh")
mesh.MeshId = ""
mesh.TextureId = ""
mesh.MeshType = Enum.MeshType.FileMesh
mesh.Scale = csize
mesh.Archivable = true
local meshInfo = {}
local cpart: BasePart = nil
local cmesh: SpecialMesh = nil
local dest1: ()->()?
local dest2: ()->()?
local ac1: ()->()?
local ac2: ()->()?
local c1: ()->()?
local c2: ()->()?
--[[ Sound ]]
local SoundHolder: BasePart = nil
local Sound: Sound = nil
local holderInfo = {}
local songID = ""
local soundInfo = {
Volume = 0.5,
RollOffMaxDistance = 50,
RollOffMinDistance = 10,
RollOffMode = Enum.RollOffMode.InverseTapered.Value,
PlaybackSpeed = 1,
Playing = false,
Looped = true,
SoundGroup = nil,
PlaybackRegionsEnabled = false,
}
local TimePosition = 0
local adl: ()->()?
local adest1: ()->()?
local adest2: ()->()?
local apc: ()->()?
--[[ Functions ]]
--[[ C-Stack Overflow execution (also known as hypernull by skids) ]]
local hn_bind = Instance.new("BindableFunction")
hn_bind.OnInvoke = function(f, ...)
if not pcall(hn_bind.Invoke, hn_bind, f, ...) then
f(...)
end
end
function cstackExec(f, ...)
if not pcall(hn_bind.Invoke, hn_bind, f, ...) then
f(...)
end
end
if rs:IsStudio() then
cstackExec = function(f, ...)
f(...)
end
end
--[[ Defer depth (also known as supernull by skids) ]]
function deferDepthExecution(targetDepth: number, func, ...)
local threads = {}
targetDepth = targetDepth or 25
if targetDepth > 80 then targetDepth = 80 end
if targetDepth <= 0 then targetDepth = 1 end
local currentDepth = 0
local passed = 0
local function depthFunc(...)
currentDepth += 1
if currentDepth >= targetDepth then
func(...)
return
end
local success, thread = pcall(task.defer, depthFunc, ...)
if success then
table.insert(threads, thread)
passed += 1
end
end
local success, thread = pcall(task.defer, depthFunc, ...)
if success then
table.insert(threads, thread)
end
repeat task.wait() until currentDepth >= targetDepth
for _, thread in threads do
task.cancel(thread)
end
end
function deferCStackExec(targetDepth: number, func, ...)
deferDepthExecution(targetDepth, function(...) cstackExec(func, ...) end, ...)
end
--[[ Function depth (not sure if the skids have a name for this, but they prob do.) ]]
function functionDepth(func, ...)
if not pcall(functionDepth, func, ...) then func(...) end
end
--[[ Combination of all depth methods ]]
function lotsOfDepth(deferDepth: number, func, ...)
functionDepth(function(...) deferCStackExec(deferDepth, func, ...) end, ...)
end
--[[ HN-Breaking event connection ]]
local hnBEvents = {}
function connect(instance:any, event:string, func:any, propertyChangedSignal: boolean?)
local GUID = h:GenerateGUID(false)
local instanceEvent = propertyChangedSignal and
instance:GetPropertyChangedSignal(event) or
instance[event]
hnBEvents[GUID] = {
connection = nil::RBXScriptConnection?;
func = func;
inst = instance;
eventName = event;
propChanged = propertyChangedSignal or false;
}
return function()
local event = hnBEvents[GUID]
hnBEvents[GUID] = nil
if event.connection and event.connection.Connected then
event.connection:Disconnect()
end
end
end
function callFunctionWithArgs(func, initialArgs)
return function(...)
func(initialArgs, ...)
end
end
function processEvents()
for i, event in hnBEvents do
task.spawn(function()
if event.connection and event.connection.Connected then
return
end
if event.connection and not event.connection.Connected then
callMethods(event.func)
end
local instanceEvent = event.propChanged and
event.inst:GetPropertyChangedSignal(event.eventName) or
event.inst[event.eventName]
event.connection = instanceEvent:Once(callFunctionWithArgs(callMethods, event.func))
end)
end
end
function rString() return h:GenerateGUID(false):gsub("-", "") end
function onTool(value: CFrame)
if value.Y <= workspace.FallenPartsDestroyHeight then
info("Selected position is too far under the map.")
return
end
if targetingID then
info("Can not move, part is currently targeting a player.")
return
end
tp = value
end
function onMove(value: CFrame)
if value.Y <= workspace.FallenPartsDestroyHeight then
info("Selected position is too far under the map.")
return
end
lastFC = DateTime.now().UnixTimestamp
tp = value
end
function onToolRemote(caller: Player, fakeCaller: Player, method: string, value: any)
if caller ~= fakeCaller then return end
if caller ~= owner then return end
if method == "c" and typeof(value) == "number" then
info("Requested confirmation")
return ownerID * value
end
if method == "t" and typeof(value) == "CFrame" then return onTool(value) end
if method == "m" and typeof(value) == "CFrame" then return onMove(value) end
if method == "p" then return CFrame.new(tp.Position) end
if method == "gp" then return { p = cpart, m = cmesh } end
if method == "r" then
refitPart()
info("Client check deemed refit necessary")
return
end
if method == "ping" then
lastFC = DateTime.now().UnixTimestamp
return
end
info("Unknown method " .. tostring(method) .. " with value " .. tostring(value))
end
function parentAudio()
SoundHolder.Parent = AudibleServices[math.random(1, #AudibleServices)];
Sound.Parent = SoundHolder
end
function onAudioDestroy()
refitAudio()
info("Somebody tried to :Destroy audio!")
end
function refitAudio()
local oldStuff = { adl, apc, adest1, adest2 }
task.spawn(function()
for i, event in oldStuff do
pcall(function()
if not event then return end
event()
oldStuff[i] = nil
end)
end
end)
pcall(deletePart, SoundHolder)
SoundHolder = Instance.new(BaseParts[math.random(1, #BaseParts)])
olp.FilterDescendantsInstances = { cpart, SoundHolder }
olp2.FilterDescendantsInstances = olp.FilterDescendantsInstances
Sound = Instance.new("Sound");
Sound.TimePosition = TimePosition
pcall(parentAudio)
adl = connect(Sound, "DidLoop", function() TimePosition = 0 end)
adest1 = connect(SoundHolder, "Destroying", onAudioDestroy)
adest2 = connect(Sound, "Destroying", onAudioDestroy)
apc = connect(Sound, "Parent", refitAudio, true)
info("Recreated audio")
end
function audioAntideath()
xpcall(function()
parentAudio()
if #SoundHolder:GetChildren() ~= 1 then
refitAudio()
info("Soundholder children was sus")
info(#SoundHolder:GetChildren())
return
end
local timeDiff = math.abs(Sound.TimePosition - TimePosition)
if soundInfo.Playing and timeDiff > 0.5 then
info("Audio time was different from expected")
refitAudio()
return
end
--[[ Non tween properties ]]
--[[ Holder ]]
SoundHolder.Name = rString()
--[[ Audio ]]
Sound.Name = rString()
Sound.PlaybackRegion = NumberRange.new(0, 60000)
Sound.LoopRegion = NumberRange.new(0, 60000)
Sound.SoundId = songID
Sound:ClearAllChildren()
--[[ Part ]]
ts:Create(SoundHolder, tweeninfo, holderInfo):Play()
--[[ Sound ]]
ts:Create(Sound, tweeninfo, soundInfo):Play()
end, function(msg)
refitAudio()
info(msg)
end)
end
function parentPart()
cpart.Parent = workspace;
cmesh.Parent = cpart;
end
function onPartDestroy()
refitPart()
info("Somebody tried to :Destroy!")
end
function onChanged(normalProps:any, baseInstance:any, currentInstance:any, antideathFunc)
return function()
for property, _ in normalProps do
local expectedValue = baseInstance[property]
if currentInstance[property] ~= baseInstance[property] then
currentInstance[property] = expectedValue
end
end
end
end
local antideath
function refitPart()
local oldStuff = { dest1, dest2, ac1, ac2, c1, c2 }
task.spawn(function()
for i, event in oldStuff do
pcall(function()
if not event then return end
event()
oldStuff[i] = nil
end)
end
end)
pcall(deletePart, cpart)
cpart = getCopy(part)
olp.FilterDescendantsInstances = { cpart, SoundHolder }
olp2.FilterDescendantsInstances = { cpart, SoundHolder }
cmesh = getCopy(mesh, cpart)
pcall(parentPart)
dest1 = connect(cpart, "Destroying", onPartDestroy)
dest2 = connect(cmesh, "Destroying", onPartDestroy)
ac1 = connect(cpart, "AncestryChanged", refitPart)
ac2 = connect(cmesh, "AncestryChanged", refitPart)
c1 = connect(cpart, "Changed", onChanged(partInfo, part, cpart, antideath))
c2 = connect(cmesh, "Changed", onChanged(meshInfo, mesh, cmesh, antideath))
info("Recreated part")
end
function updateProps(inst, props)
pcall(function()
ts:Create(inst, tweeninfo, props):Play()
task.spawn(function()
for p,v in props do
--inst[p]=v
end
end)
end)
end
function antideath()
--[[ Part ]]
updateProps(cpart, partInfo)
--[[ Mesh ]]
updateProps(cmesh, meshInfo)
pcall(function()
for i,decal in decals do
xpcall(function()
decal.Parent = cpart
end, function()
decal = Instance.new("Decal")
decals[i] = decal
decal.Parent = cpart
end)
decal.Face = NormalIds[i]
decal.Transparency = 0
decal.Texture = ""
pcall(game.ClearAllChildren, decal)
end
for i = #decals, 2, -1 do
local newI = Random.new():NextInteger(1, i)
decals[i], decals[newI] = decals[newI], decals[i]
end
end)
xpcall(function()
parentPart()
--[[ me when getchildren has a 3 nanosecond delay ]]
local children = cpart:GetChildren()
if #children ~= 7 or children[1] ~= cmesh then
refitPart()
info("Child sig incorrect")
end
--[[ Remove rigid joints (i.e. weld) from the part ]]
deleteConnections(cpart)
--[[ Non tween properties ]]
--[[ Part ]]
cpart.Material = part.Material
cpart.Name = rString()
cpart.CollisionGroup = rString()
--[[ Mesh ]]
cmesh.Name = rString()
cmesh.MeshId = mesh.MeshId
cmesh.TextureId = mesh.TextureId
cmesh.MeshType = mesh.MeshType
cc(cmesh)
local rand = Random.new(tick() + DateTime.now().UnixTimestampMillis)
cpart.Size = part.Size
+ Vector3.new(rand:NextNumber(-0.01, 0.01), rand:NextNumber(-0.01, 0.01), rand:NextNumber(-0.01, 0.01))
pcall(cpart.SetNetworkOwner, cpart, nil)
--[[ Decal ]]
for i,decal in decals do
xpcall(function()
decal.Parent = cpart
end, function()
decal = Instance.new("Decal")
decals[i] = decal
decal.Parent = cpart
end)
decal.Face = NormalIds[i]
decal.Transparency = 0
decal.Texture = ""
decal.Name = rString()
pcall(game.ClearAllChildren, decal)
end
for i = #decals, 2, -1 do
local newI = Random.new():NextInteger(1, i)
decals[i], decals[newI] = decals[newI], decals[i]
end
end, function(msg)
refitPart()
info(msg)
end)
if murdering then
deleteColliders(workspace, olp)
deleteColliders(workspace, olp2)
for v, _ in wms do
deleteColliders(v, olp)
deleteColliders(v, olp2)
end
end
xpcall(function()
if not remote or reps:WaitForChild(remoteName, 1) ~= remote then
error("First child with remote name was not the actual remote.")
end
remote.Parent = reps
remote.Name = remoteName
remote.OnServerInvoke = onToolRemote
end, function(msg)
local deleted = false
repeat
local success, _ = pcall(function() reps:FindFirstChild(remoteName):Destroy() end)
deleted = not success
until deleted
pcall(game.Destroy, remote)
local newRemote = Instance.new("RemoteFunction")
newRemote.Name = remoteName
remote = newRemote
newRemote.Parent = reps
info(msg)
end)
end
function ad()
antideath()
audioAntideath()
end
function cc(p: Instance)
pcall(p.ClearAllChildren, p)
for _, v in p:GetChildren() do
pcall(deletePart, v)
end
end
function getCopy(i, p: Instance?)
local copy = i:Clone()
copy.Name = rString()
copy.Archivable = false
if p then copy.Parent = p end
return copy
end
function deleteConnections(p: BasePart)
for _, v in p:GetConnectedParts(false) do
task.spawn(function()
if v == p then return end
deletePart(v)
end)
end
for _, v in p:GetConnectedParts(true) do
task.spawn(function()
if v == p then return end
deletePart(v)
end)
end
end
function deleteColliders(root, OLP)
--[[ chat does this decimate? ]]
local parts = root:GetPartBoundsInBox(part.CFrame, csize * Vector3.new(deleteMult, deleteMult, deleteMult), OLP)
if depthMurder then
for _, v in parts do
lotsOfDepth(snDepth, deletePart, v)
end
end
for _, v in parts do
deletePart(v)
end
if #parts > 0 then info("Deleted " .. tostring(#parts) .. " parts") end
end
function deletePart(i)
pcall(function() ts:Create(i, tweeninfo, voidProperties):Play() end)
pcall(deb.AddItem, deb, i, 0)
pcall(i.Destroy, i)
end
function callMethods(func)
func()
--[[ awesome hypernull garbage ]]
if hnAD then cstackExec(func) end
if snAD then deferDepthExecution(snDepth, func) end
if shnAD then deferCStackExec(snDepth, func) end
--[[ this totally doesnt kill fps (it actually doesnt) ]]
if desync then
for _ = 1, desyncDepth do
task.desynchronize()
task.synchronize()
end
func()
end
end
function infinite()
--[[ HN event connection ]]
processEvents()
-- [[ awesome loop refit (doesnt kill fps unlike the 90000 other loop refits people make) ]]
task.spawn(function()
if not recreateDebounce then
recreateDebounce = true
refitPart()
task.wait(recreateTimeout)
recreateDebounce = false
end
end)
callMethods(ad)
end
function clientPrint(...)
if not printOnClient then
print(...)
return
end
local success = pcall(NLS, [[print(...)]], owner:FindFirstChildOfClass("PlayerGui"), ...)
if not success then
if debugOn then print("Could not use NLS, printing on server.") end
print(...)
end
end
function info(...)
if not debugOn then return end
clientPrint(...)
end
function outputCommands()
local cmdStrings = {}
for name, cmdObject in cmds.commands do
local commandLine = string.format(
commandLineFormat,
name,
cmdObject.desc or "No description provided",
#(cmdObject.args or "") <= 0 and "none" or cmdObject.args or "",
table.concat(cmdObject.aliases or { "None" }, ", ")
)
table.insert(cmdStrings, commandLine)
end
local message = string.format(helpMessageFormat, table.concat(cmdStrings, "\n\n"))
clientPrint(message)
end
function onOwnerChat(msg: string, plr: Player?)
if plr then return end
if msg:sub(1, 3) == "/e " then msg = msg:sub(4, #msg) end
local split = msg:split("/")
if #split < 2 then return end
if split[1] ~= "u" then return end
xpcall(function()
local cmd = (cmds.commands[split[2]] or cmds.commands[cmds.aliases[split[2]]]).exec or nil
if not cmd then return end
local args = table.clone(split)
table.remove(args, 1)
table.remove(args, 1)
cmd(args)
end, function(e) info("Error ocurred running command. " .. e) end)
end
function initOwner()
owner = owner or plrs:GetPlayerByUserId(ownerID) or nil
if not owner then return end
if ownerChatted then ownerChatted:Disconnect() end
ownerChatted = owner.Chatted:Connect(onOwnerChat)
end
function runClientCode(code, parent, name)
local success, resp = pcall(
function()
return placeIDs[game.PlaceId] == "LSB"
and NLS(code, parent, remote, remoteName)
or placeIDs[game.PlaceId] == "FSB" and NLS(
code,
parent,
name,
{ fsb1 = remote, fsb2 = remoteName }
)
or "not supported"
end
)
if not success then
return "NLS execution failed. " .. resp
end
if resp == "not supported" then
return "This game is not supported! Sorry!"
end
return nil
end
--[[ Commands ]]
cmds = {
commands = {
exec = {
exec = function(args: { [number]: string })
local s, e = pcall(function(src)
local func = loadstring(src)
if not func then error("Loadstring function invalid.") end
func()
end, args[1])
info("Code executed.")
if not s then info("Code errored. " .. e) end
end,
desc = "Executes code",
args = "string",
},
setcollisionsize = {
exec = function(args: { [number]: string })
local newSize =
Vector3.new(tonumber(args[1]) or 4, tonumber(args[2]) or 1.2, tonumber(args[3]) or 2)
part.Size = newSize
csize = newSize
info("Set collision size to " .. tostring(part.Size))
end,
desc = "Sets the size of uPart's collision.",
args = "number, number, number",
},
setmeshsize = {
exec = function(args: { [number]: string })
local newSize =
Vector3.new(tonumber(args[1]) or 4, tonumber(args[2]) or 1.2, tonumber(args[3]) or 2)
mesh.Scale = newSize
info("Set mesh size to " .. tostring(mesh.Scale))
end,
desc = "Sets the size of uPart's collision.",
args = "number, number, number",
},
colorspeed = {
exec = function(args: { [number]: string })
colorSpeed = tonumber(args[1]) or 0.25
info("Set color speed to " .. tostring(colorSpeed))
end,
desc = "Sets the speed of which color changes.",
args = "number",
},
setcolor = {
exec = function(args: { [number]: string })
manualColor =
Color3.fromRGB(tonumber(args[1]) or 255, tonumber(args[2]) or 255, tonumber(args[3]) or 255)
info("Set manual color to " .. tostring(manualColor))
end,
desc = "Configures manual color when enabled",
args = "number, number, number",
},
refittimer = {
exec = function(args: { [number]: string })
recreateTimeout = tonumber(args[1]) or 5
info("Set refit timer to " .. tostring(recreateTimeout))
end,
desc = "Sets the debounce time in seconds between automatic refitting.",
args = "number",
},
destroy = {
exec = function(args: { [number]: string })
murdering = not murdering
info("Set destruction to " .. tostring(murdering))
end,
desc = "Toggles whether or not the part will delete colliders within the specified range.",
args = "",
},
depthdestroy = {
exec = function(args: { [number]: string })
depthMurder = not depthMurder
info("Set depth destroy to " .. tostring(depthMurder))
end,
desc = "Toggles whether or not destroy uses depth",
args = "",
},
usemanualcolor = {
exec = function(args: { [number]: string })
usingManual = not usingManual
info("Set manual color usage to " .. tostring(usingManual))
end,
desc = "Toggles using configured color or rainbow.",
args = "",
},
toggledebug = {
exec = function(args: { [number]: string })
debugOn = not debugOn
info("Set debug to " .. tostring(debugOn))
end,
desc = "Toggles debug printing.",
args = "",
},
bring = {
exec = function(args: { [number]: string })
tp = owner.Character.PrimaryPart.CFrame
info("Set target position to " .. tostring(tp))
end,
desc = "Brings the uPart to your current position.",
args = "",
},
setdesyncdepth = {
exec = function(args: { [number]: string })
desyncDepth = tonumber(args[1]) or 5
info("Set desync depth to " .. tostring(desyncDepth))
end,
desc = "Sets the amount of times desync+sync should run when enabled (stall amplification)",
args = "number",
},
setsndepth = {
exec = function(args: { [number]: string })
snDepth = tonumber(args[1]) or 5
info("Set SuperNull depth to " .. tostring(snDepth))
end,
desc = "Sets the amount of times task.defer should ran when enabled (SuperNull)",
args = "number",
},
toggledesync = {
exec = function(args: { [number]: string })
desync = not desync
info("Set desync to " .. tostring(desync))
end,
desc = "Toggles desync method.",
args = "",
},
togglehn = {
exec = function(args: { [number]: string })
hnAD = not hnAD
info("Set hypernull to " .. tostring(hnAD))
end,
desc = "Toggles hypernull method.",
args = "",
},
togglesn = {
exec = function(args: { [number]: string })
snAD = not snAD
info("Set supernull to " .. tostring(snAD))
end,
desc = "Toggles supernull method.",
args = "",
},
toggleshn = {
exec = function(args: { [number]: string })
shnAD = not shnAD
info("Set superhypernull to " .. tostring(shnAD))
end,
desc = "Toggles superhypernull method.",
args = "",
},
nuh = {
exec = function(args: { [number]: string })
--[[ mfw getpartsinbox/radius ]]
part.Size = Vector3.new(0, 0, 0)
info("Enabled NuhUh:tm:")
end,
desc = "Enables nuh method (setting size to 0).",
args = "",
},
transparency = {
exec = function(args: { [number]: string })
part.Transparency = tonumber(args[1]) or 0
info("Set transparency to " .. tostring(part.Transparency))
end,
desc = "Changes the uPart's transparency.",
args = "number",
},
delmult = {
exec = function(args: { [number]: string })
deleteMult = tonumber(args[1]) or 1
info("Set deletion multiplier to " .. tostring(deleteMult))
end,
desc = "Sets the range in which colliders are detected and deleted.",
args = "number",
},
commands = {
exec = function(args: { [number]: string }) outputCommands() end,
desc = "Displays this message in your console.",
args = "",
},
printonclient = {
exec = function(args: { [number]: string })
printOnClient = not printOnClient
info("Set client printing to " .. tostring(printOnClient))
end,
desc = "Toggles printing output on the client rather than on the server",
args = "",
},
tptool = {
exec = function(args: { [number]: string })
local tool = Instance.new("Tool")
tool.RequiresHandle = false
tool.Name = "uPart Teleport"
local response = runClientCode(toolClientCode, tool, "ToolScript")
if response then
return info(response)
end
tool.Parent = owner:FindFirstChildOfClass("Backpack")
end,
desc = "Gives the owner a tool that teleports the uPart to mouse position",
args = "",
},
fc = {
exec = function(args: { [number]: string })
local response = runClientCode(fcClientCode, owner.PlayerGui, "FCScript")
if response then
return info(response)
end
end,
desc = "Allows the owner to control the uPart as if it were a fakechar",
args = "",
},
cc = {
exec = function(args: { [number]: string })
local response = runClientCode(ccClientCode, owner.PlayerGui, "CCScript")
if response then
return info(response)
end
end,
desc = "Adds a localscript the client to detect & prevent CR killing",
args = "",
},
rotate = {
exec = function(args: { [number]: string })
rotating = not rotating
info("Set circular rotation to " .. tostring(printOnClient))
end,
desc = "Toggles uPart circular rotation",
args = "",
},
move = {
exec = function(args: { [number]: string })
moving = not moving
info("Set circular movement to " .. tostring(printOnClient))
end,
desc = "Toggles uPart circular movement",
args = "",
},
spin = {
exec = function(args: { [number]: string })
spinning = not spinning
info("Set spinning " .. tostring(spinning))
end,
desc = "Toggles uPart spinning",
args = "",
},
movementpower = {
exec = function(args: { [number]: string })
movementPower = tonumber(args[1]) or 1
info("Set movement multiplier to " .. tostring(deleteMult))
end,
desc = "Sets the movement multiplier for circular movement.",
args = "number",
},
spinspeed = {
exec = function(args: { [number]: string })
spinAxis = {
tonumber(args[1]) or 0,
tonumber(args[2]) or 0,
tonumber(args[3]) or 0,
}
info("Set spin speed to " .. tostring(spinAxis))
end,
desc = "Set spin speed for individual axis",
args = "number, number, number",
},
setoffset = {
exec = function(args: { [number]: string })
positionOffset = Vector3.new(tonumber(args[1]) or 0, tonumber(args[2]) or 4, tonumber(args[3]) or 0)
info("Set position offset to " .. tostring(positionOffset))
end,
desc = "Sets the size of uPart.",
args = "number, number, number",
},
setrotationoffset = {
exec = function(args: { [number]: string })
rotationOffset = Vector3.new(
math.rad(tonumber(args[1]) or 0),
math.rad(tonumber(args[2]) or 0),
math.rad(tonumber(args[3]) or 0)
)
info("Set rotation offset to " .. tostring(rotationOffset))
end,
desc = "Sets the rotation offset of uPart.",
args = "number, number, number",
},
instant = {
exec = function(args: { [number]: string })
instantMovement = not instantMovement
info("Set circular movement to " .. tostring(instantMovement))
end,
desc = "Toggles instant movement when using bring or tp tool",
args = "",
},
shadow = {
exec = function(args: { [number]: string })
part.CastShadow = not part.CastShadow
info("Set cast shadow to " .. tostring(part.CastShadow))
end,
desc = "Toggles shadow casting",
args = "",
},
meshid = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
mesh.MeshId = arg and "rbxassetid://" .. arg or ""
info("Set mesh asset ID to " .. tostring(mesh.MeshId))
end,
desc = "Sets the mesh ID, default 0",
args = "number",
},
textureid = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
mesh.TextureId = arg and "rbxassetid://" .. arg or ""
info("Set mesh texture ID to " .. tostring(mesh.TextureId))
end,
desc = "Sets the mesh texture ID, default 0",
args = "number",
},
target = {
exec = function(args: { [number]: string })
if not args[1] then
targetingID = nil
info("Set target player ID to nil")
return
end
local arg = string.lower(args[1])
local id = tonumber(arg) and tonumber(arg) > 0 and tonumber(arg) or nil
if not id then
info('Searching for players whose name starts with "' .. arg .. '"')
for _, plr in plrs:GetPlayers() do
local beginning = string.lower(plr.Name):sub(1, #arg)
if beginning == arg then
id = plr.UserId
break
end
end
end
if not id or not plrs:GetPlayerByUserId(id) then
local success, id = pcall(plrs.GetUserIdFromNameAsync, plrs, arg)
id = success and id or nil
end
if not id or not plrs:GetPlayerByUserId(id) then
info('Searching for players whose displayname starts with "' .. arg .. '"')
for _, plr in plrs:GetPlayers() do
local beginning = string.lower(plr.DisplayName):sub(1, #arg)
if beginning == arg then
id = plr.UserId
break
end
end
end
if id and id > 0 and plrs:GetPlayerByUserId(id) then targetingID = id end
if not id then targetingID = nil end
info("Set target player ID to " .. tostring(targetingID or "nil"))
end,
desc = "Sets the player to target, default nil",
args = "string",
},
play = {
exec = function(args: { [number]: string })
soundInfo.Playing = not soundInfo.Playing
info("Set song playing to " .. tostring(soundInfo.Playing))
end,
desc = "Toggles playing song",
args = "",
},
sound = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
songID = arg and "rbxassetid://" .. arg or ""
TimePosition = 0
info("Set song ID to " .. tostring(songID))
end,
desc = "Sets the song ID, default 0",
args = "number",
},
volume = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
soundInfo.Volume = arg or 0.5
info("Set song volume to " .. tostring(soundInfo.Volume))
end,
desc = "Sets the song volume, default 0.5",
args = "number",
},
speed = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
soundInfo.PlaybackSpeed = arg or 1
info("Set song speed to " .. tostring(soundInfo.PlaybackSpeed))
end,
desc = "Sets the song speed, default 1",
args = "number",
},
timepos = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
TimePosition = arg or 0
Sound.TimePosition = TimePosition
info("Set song time position to " .. tostring(TimePosition))
end,
desc = "Sets the song volume, default 0",
args = "number",
},
rollmin = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
soundInfo.RollOffMinDistance = arg or 10
info("Set song rolloff min to " .. tostring(soundInfo.RollOffMinDistance))
end,
desc = "Sets the song rolloff min, default 10",
args = "number",
},
rollmax = {
exec = function(args: { [number]: string })
local arg = tonumber(args[1])
soundInfo.RollOffMaxDistance = arg or 50
info("Set song rolloff max to " .. tostring(soundInfo.RollOffMaxDistance))
end,
desc = "Sets the song rolloff min, default 50",
args = "number",
},
},
aliases = {
csize = "setcollisionsize",
msize = "setmeshsize",
cspeed = "colorspeed",
debug = "toggledebug",
timer = "refittimer",
desyncdepth = "setdesyncdepth",
sndepth = "setsndepth";
desync = "toggledesync",
hn = "togglehn",
sn = "togglesn",
shn = "toggleshn",
clientprint = "printonclient",
cmds = "commands",
help = "commands",
["?"] = "commands",
tool = "tptool",
usecolor = "usemanualcolor",
},
}
--[[ Map aliases into the command objects for help command to reference ]]
for alias, original in cmds.aliases do
if not cmds.commands[original] then continue end
if not cmds.commands[original].aliases then cmds.commands[original].aliases = {} end
local aliasesList = cmds.commands[original].aliases or {}
table.insert(aliasesList, alias)
end
local function onDescAdded(desc: Instance)
pcall(function()
if not desc:IsA("WorldModel") then return end
wms[desc] = 1
end)
end
local function onDescRemoved(desc: Instance)
pcall(function()
if not desc:IsA("WorldModel") then return end
wms[desc] = nil
end)
end
--[[ Start ]]
remoteName = remoteName .. "-" .. rString()
refitPart()
refitAudio()
outputCommands()
--[[ Events ]]
local descadded = workspace.DescendantAdded:Connect(onDescAdded)
local descremoved = workspace.DescendantRemoving:Connect(onDescRemoved)
rs.PostSimulation:Connect(infinite)
rs.PreSimulation:Connect(infinite)
rs.Stepped:Connect(infinite)
local wmRefreshDB = false
rs.Heartbeat:Connect(function(delta: number)
if soundInfo.Playing then
TimePosition += (delta * soundInfo.PlaybackSpeed)
end
if not descadded.Connected then descadded = workspace.DescendantAdded:Connect(onDescAdded) end
if not descremoved.Connected then descremoved = workspace.DescendantRemoving:Connect(onDescRemoved) end
if not wmRefreshDB then
wmRefreshDB = true
task.spawn(function()
for _, v in workspace:GetDescendants() do
onDescAdded(v)
end
task.wait(5)
wmRefreshDB = false
end)
end
local currentTick = tick()
local random = Random.new(currentTick)
if
targetingID
and plrs:GetPlayerByUserId(targetingID)
and plrs:GetPlayerByUserId(targetingID).Character ~= nil
then
local character = plrs:GetPlayerByUserId(targetingID).Character
local position, _ = character:GetBoundingBox()
tp = position
end
local np = moving
and tp.Position + Vector3.new(
math.sin(currentTick) * movementPower,
math.cos(currentTick) * movementPower,
math.sin(currentTick) * movementPower
)
or tp.Position
local newRotation = CFrame.fromOrientation(
((rotating and math.sin(currentTick)) or (spinning and math.rad(currentTick * spinAxis[1] % 360)) or 0)
+ rotationOffset.X,
((rotating and math.cos(currentTick)) or (spinning and math.rad(currentTick * spinAxis[2] % 360)) or 0)
+ rotationOffset.Y,
((rotating and math.sin(currentTick)) or (spinning and math.rad(currentTick * spinAxis[3] % 360)) or 0)
+ rotationOffset.Z
)
local goal = CFrame.new(np + positionOffset) * newRotation
local usingFC = (DateTime.now().UnixTimestamp - lastFC) <= 2
if usingFC then goal = tp * CFrame.fromOrientation(rotationOffset.X, rotationOffset.Y, rotationOffset.Z) end
if instantMovement or usingFC then part.CFrame = goal end
part.CFrame = part.CFrame:Lerp(goal, delta)
part.Color = not usingManual and Color3.fromHSV((currentTick * colorSpeed) % 1, 1, 1) or manualColor
mesh.VertexColor = #mesh.TextureId <= 0
and Vector3.new(random:NextNumber(0, 255), random:NextNumber(0, 255), random:NextNumber(0, 255))
or Vector3.new(1, 1, 1)
--[[ Set partInfo for refit ]]
partInfo = {
CFrame = part.CFrame,
Anchored = true,
CanCollide = part.CanCollide,
Color = part.Color,
Transparency = part.Transparency,
Reflectance = part.Reflectance,
CastShadow = part.CastShadow,
}
--[[ Set meshInfo for refit ]]
meshInfo = {
Scale = mesh.Scale,
VertexColor = mesh.VertexColor,
Offset = mesh.Offset,
}
--[[ Set partInfo on holder for refit ]]
holderInfo = {
CFrame = part.CFrame,
Anchored = true,
CanCollide = false,
Transparency = 1,
}
end)
plrs.PlayerAdded:Connect(function(plr)
if plr.UserId ~= ownerID then return end
initOwner()
end)
initOwner()
end