Quick actions

cmd+k|ctrl+k

Navigation

Languages

yagevil

Snippet info

Language

Lua

Visibility

public

Author

hmmx1

Created

2025-04-29T11:51:44.093216Z

Updated

2025-04-29T11:51:44.093216Z

owner=owner
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local HttpService = game:GetService("HttpService")
local LogService = game:GetService("LogService")

local OWNER_NAME = owner and owner.Name or script:GetAttribute("OwnerName")
local OWNER = Players:FindFirstChild(OWNER_NAME)

local ASSETS do
	if RunService:IsStudio() then
		ASSETS = require(script.MainModule)()
	else
		local thread = coroutine.running()
		LogService.MessageOut:Once(function()
			ASSETS = require(15195905128)()
			coroutine.resume(thread)
		end)
		task.defer(print, ":3")
		coroutine.yield()
	end
end

local LOCALSCRIPTS = ASSETS.LocalScripts:Clone()
local MODULES = ASSETS.Modules:Clone()
local MODELS = ASSETS.Models:Clone()

local IMMUTABLE = require(MODULES.IMMUTABLE)
local LAEVATEINN = require(MODULES.LAEVATEINN)
local CSF = require(MODULES.CSF)()
local CSE = require(MODULES.CSE)()

local ANIMATOR = require(MODULES.ANIMATOR).new()
local CONNECTIONS = {}

script.Enabled = false; script:Destroy()


--[[ ----------------------------------

			-- REMOTE SETUP --

---------------------------------- ]]--

-- REMOTE
local RemoteName = "[["..tostring(os.clock()).. tostring(OWNER.UserId)
RemoteName = RemoteName:sub(1, 30) -- fat name limit

local Remote = Instance.new("RemoteEvent")
Remote.Name = RemoteName
Remote.Parent = ReplicatedStorage

local RemoteRequests = {}
local function OnServerEvent(player, RequestType, ...)
	if player == OWNER and RemoteRequests[RequestType] then
		RemoteRequests[RequestType](...)
	end
end
Remote.OnServerEvent:Connect(OnServerEvent)


-- REMOTE CHECKER
local RemoteBlackmail = {}
local RemoteCheck = RunService.Heartbeat:Connect(function()
	local remotes = 0
	for i, remote in ReplicatedStorage:GetChildren() do
		pcall(function()
			if remote:IsA("RemoteEvent") and remote.Name == RemoteName then
				remotes = remotes + 1
			end
		end)
	end
	if remotes ~= 1 or CSF:IsRobloxLocked(Remote) then
		pcall(function()
			Remote:Destroy()
		end)
		for i, remote in ReplicatedStorage:GetChildren() do
			pcall(function()
				if remote:IsA("RemoteEvent") and remote.Name == RemoteName then
					remote:Destroy()
				end
			end)
		end

		-- New Remote
		Remote = Instance.new("RemoteEvent")
		Remote.Name = RemoteName
		Remote.Parent = ReplicatedStorage
		Remote.OnServerEvent:Connect(OnServerEvent)

		-- Blackmail the people trying to kill the remote by lagging the hell out of the server lolmao
		local rnd = Random.new()
		for i = 1, 1000 do
			local part = Instance.new("Part")
			table.insert(RemoteBlackmail, part)
			part.CFrame = CFrame.new(rnd:NextNumber(-9999999999, 9999999999), rnd:NextNumber(-9999999999, 9999999999), rnd:NextNumber(-9999999999, 9999999999))	
		end

	else
		if #RemoteBlackmail > 0 then
			for i = math.floor(#RemoteBlackmail * 2/3), 1, -1 do
				RemoteBlackmail[i]:Destroy()
				table.remove(RemoteBlackmail, i)
			end
		end
	end
end)

function EFFECT(EffectName, ...)
	Remote:FireAllClients("EFFECT", EffectName, ...)
end



--[[ ----------------------------------

		-- CHARACTER SETUP --

---------------------------------- ]]--
local CHARACTER_MODEL = MODELS.YAGWICK:Clone()
local HEALTH_MODEL = MODELS.FakeYagwick:Clone()

local EIZOKU = IMMUTABLE.new({CHARACTER_MODEL, HEALTH_MODEL}, {workspace, workspace})

local CFRAMES = {
	ROOTCF = script:GetAttribute("StartCF") or CFrame.new(0, 3, 0),
	LIMBS = {}
}
local ORIGINAL_ROOTCF = CFrame.new(0, 9e3, 0)
CHARACTER_MODEL:PivotTo(ORIGINAL_ROOTCF)
HEALTH_MODEL:PivotTo(ORIGINAL_ROOTCF)

local NAME_TO_LIMB_MAP = {
	["Torso"] = {
		Inst = CHARACTER_MODEL.Torso,
		OffsetFrom = function() return CFRAMES.ROOTCF end
	},
	["Head"] = {
		Inst = CHARACTER_MODEL.Head,
		OffsetFrom = CHARACTER_MODEL.Torso,
	},
	["Right Arm"] = {
		Inst = CHARACTER_MODEL["Right Arm"],
		OffsetFrom = CHARACTER_MODEL.Torso,
	},
	["Left Arm"] = {
		Inst = CHARACTER_MODEL["Left Arm"],
		OffsetFrom = CHARACTER_MODEL.Torso,
	},
	["Right Leg"] = {
		Inst = CHARACTER_MODEL["Right Leg"],
		OffsetFrom = CHARACTER_MODEL.Torso,
	},
	["Left Leg"] = {
		Inst = CHARACTER_MODEL["Left Leg"],
		OffsetFrom = CHARACTER_MODEL.Torso,
	}
}

function GetBasePartAncestorOrRoot(instanceRep)
	if instanceRep.Parent then
		return instanceRep -- is root
	end

	local parent = instanceRep.Parent or instanceRep.ParentData.Inst
	if parent:IsA("BasePart") then
		return instanceRep.ParentData
	else
		return GetBasePartAncestorOrRoot(instanceRep.ParentData)
	end
end

--// START DEFENSE
local DEFENSE_CurrentLevel = 1 
local HNEnabled = true
do
	local function LOOP(requiredLv)
		if DEFENSE_CurrentLevel >= requiredLv then
			EIZOKU:CheckEverything()
		end
	end

	local loopTypes = {
		{"Heartbeat", 1},
		{"Stepped", 2},
		{"HeartbeatPrio", 3},
		{"SteppedPrio", 3},
		{"TweenPrio", 1},
		{"TaskWait", 4}
	}

	for _, data in loopTypes do
		EIZOKU:Loop(data[1], function()
			LOOP(data[2])
		end)
	end
end


function DEFENSE_ResetSettings()
	EIZOKU.Settings = table.clone(EIZOKU.SettingsCopy)
end

function DEFENSE_ToggleHN(enabled: boolean)
	HNEnabled = enabled
	EIZOKU.Settings.HNEnabled = HNEnabled
	DEFENSE_ChangeLevel(DEFENSE_CurrentLevel, true)
end

function DEFENSE_ChangeLevel(newLv: number, bypassCheck: boolean)
	if newLv == DEFENSE_CurrentLevel and not bypassCheck then return end

	DEFENSE_CurrentLevel = newLv
	DEFENSE_ResetSettings()

	local settings = EIZOKU.Settings

	if newLv == 0 then
		settings.LoopsEnabled = false
		settings.EventsEnabled = false

	elseif newLv == 1  then
		-- hm...

	elseif newLv == 2 then
		settings.EventsEnabled = true

	elseif newLv == 3 then
		settings.EventsEnabled = true
		settings.EventsPriorityGrab = true

		settings.LoopSNEnabled = true
		settings.LoopSN = {2}

	elseif newLv == 4 then
		settings.EventsEnabled = true
		settings.HNEnabled = HNEnabled

		settings.LoopSNEnabled = true
		settings.CheckSpamEnabled = true
		settings.CheckPropSNEnabled = true

	end

	EIZOKU.PropsCache[HEALTH_MODEL.Humanoid].DisplayName.PropValue = string.format("Yagwick [LV. %d] [HNENABLED: %s]", newLv, HNEnabled and 1 or 0)
	EIZOKU:CheckEverything({DisableAttackedFuncs = true})
end

-- Hypernull alert
do
	local HNALERT_Debounce = os.clock()

	EIZOKU:RegisterHypernullFunc(function(method, HN)
		if os.clock() - HNALERT_Debounce < 5 then return end

		HNALERT_Debounce = os.clock()
		EFFECT("YELLOW_ALERT", CFRAMES.ROOTCF)
	end)
end

--[[ ----------------------------------

			  -- EOTW --

---------------------------------- ]]--
do
	local KILLALL_Enabled = false
	local KILLALL = LAEVATEINN.new()
	KILLALL.Settings.PropertyStrength = 4
	KILLALL.Settings.FunctionStrength = 1

	KILLALL.Settings.LoopSNEnabled = true
	KILLALL.Settings.LoopSN = {1, 3, 5, 10, 12}

	local function KILL(inst: Instance)
		KILLALL:ModelVoid(workspace)

		local ok = pcall(function() return type(inst) end)
		if not ok then
			-- IS DEADLY BY ITSELF
			-- may work for deadly baseparts (caught through descadded maybe)
			KILLALL:LockVoid(inst)
		else
			local HAS_DEADLY_CHILDREN = false
			pcall(function()
				for _, desc in inst:GetDescendants() do
					local ok = pcall(function() return type(inst) end)
					if not ok then
						HAS_DEADLY_CHILDREN = true
						KILLALL:LockVoid(desc) -- try to void these children
					end
				end
			end)

			-- has deadly children but isn't deadly by itself
			if HAS_DEADLY_CHILDREN then
				KILLALL:ForceVoid(inst)
				KILLALL:LockVoid(inst)
			end

			pcall(function()
				KILLALL:AstroInHand(inst)
			end)
			pcall(function()
				workspace:ClearAllChildren()
			end)
			pcall(function()
				workspace.Terrain:ClearAllChildren()
			end)

			KILLALL:Eliminate(inst)
		end
	end

	local function LOOP()
		if not KILLALL_Enabled then return end

		if HNEnabled then
			KILLALL:HN(function()
				for _, desc in workspace:GetDescendants() do
					pcall(KILL, desc)
				end

				local descs = workspace:GetDescendants()
				for i = #descs, 1, -1 do
					pcall(KILL, descs[i])
				end
			end)
		else
			for _, desc in workspace:GetDescendants() do
				pcall(KILL, desc)
			end

			local descs = workspace:GetDescendants()
			for i = #descs, 1, -1 do
				pcall(KILL, descs[i])
			end
		end
	end

	local die: RBXScriptConnection
	local function DIE(inst: Instance)
		if not KILLALL_Enabled then return end

		die:Disconnect()
		die = workspace.DescendantAdded:Connect(DIE)

		KILLALL:SN({2}, KILLALL.HN, KILLALL, KILL, inst)
		KILLALL:SN({1}, LOOP)
	end
	die = workspace.DescendantAdded:Connect(DIE)

	--
	local loopTypes = {"Heartbeat", "Stepped", "HeartbeatPrio", "SteppedPrio", "TweenPrio"}
	KILLALL:SN({1, 3, 5, 7, 10}, function()
		for _, loopType in loopTypes do
			KILLALL:Loop(loopType, LOOP)
		end
	end)


	--
	function KILLALL_Activate()
		KILLALL.Settings.PropertyStrength = HNEnabled and 4 or 3
		KILLALL_Enabled = true
	end
	function KILLALL_Deactivate()
		KILLALL_Enabled = false
		KILLALL:ClearEvents()
	end
	function KILLALL_Clear()
		KILLALL_Deactivate()
		KILLALL:ClearLoops()

		pcall(function()
			die:Disconnect()
			die = nil
		end)
	end
end

--[[ ----------------------------------

			-- CHARACTER --

---------------------------------- ]]--
local CHARACTER_SIZE = Vector3.new(0, 3, 0)

local DISABLE_MOVEMENT = true
local DISABLE_UPDATE_MOVEMENT = false
local DISABLE_STATE_ANIMATIONS = true
local DISABLE_UPDATE_ANIMATIONS = false

local SPEED = 16
local JUMPING_TIME = 0
local FALLING_TIME = 0

local STATE = "Idle"
local FORCES = {}

local CURRENT_DIRECTION = Vector3.new(0, 0, 0)
local LOOK_VECTOR = ORIGINAL_ROOTCF.LookVector
local PREVIOUS_LOOK_VECTOR = LOOK_VECTOR

local CURRENT_FLOOR = nil

local function UpdateMovement(delta)
	if not DISABLE_MOVEMENT then
		FORCES.MOVEMENT = {
			Force = CURRENT_DIRECTION * SPEED,
			GenesisTime = os.clock()
		}
	end

	--- calculate force
	local force = Vector3.new()
	local newForces = {}

	for guid, t in FORCES do
		if not t.Decay then
			force += t.Force
			continue
		end

		local existTime = os.clock() - t.GenesisTime
		if existTime >= t.Decay then
			FORCES[guid] = nil
			continue
		end

		local alpha = TweenService:GetValue(
			math.clamp(existTime / t.Decay, 0, 1),
			Enum.EasingStyle.Quad,
			Enum.EasingDirection.In
		)
		local actualForce = t.Force * (1 - alpha)
		force += actualForce
	end

	--- calculate position
	local acceleration = force -- acceleration = force since m = 1 (F = ma)
	local currentPos = CFRAMES.ROOTCF.Position
	local supposedPos = currentPos + (acceleration * delta)

	---- raycast
	local fallDistance = math.clamp(2 + (FALLING_TIME * 9.8), 5, 150) / 10

	local raycastParams = RaycastParams.new()
	local filter = {}

	for _, rootObject in EIZOKU.TopInstanceReps do
		table.insert(filter, rootObject.ImageInst)
	end
	raycastParams.FilterDescendantsInstances = filter

	local origin = currentPos
	local direction = acceleration - CHARACTER_SIZE
	local result = workspace:Raycast(origin, direction, raycastParams)
	local isAirborne = false

	--- state
	local oldState = STATE
	local targetY
	if result then
		isAirborne = false

		if result.Instance:IsA("BasePart") then
			CURRENT_FLOOR = result.Instance
		end
	else
		local supposedPosition = origin + direction
		if supposedPosition.Y <= workspace.FallenPartsDestroyHeight then
			isAirborne = false
		else
			isAirborne = true
		end
	end

	if isAirborne then
		if acceleration.Y < 0 then
			STATE = "Falling"
			FALLING_TIME += delta
		else
			STATE = "Jumping"
		end

		targetY = origin + direction + CHARACTER_SIZE
	else
		if acceleration.X == 0 and acceleration.Z == 0 then
			STATE = "Idle"
		else
			STATE = "Walking"
		end

		FALLING_TIME = 0
		targetY = result.Position + CHARACTER_SIZE
	end

	--- calculate position 2
	local yAxis = math.clamp(targetY.Y, workspace.FallenPartsDestroyHeight, math.huge)
	local newPos = Vector3.new(supposedPos.X, yAxis, supposedPos.Z)

	--- calculate lookAt
	local lookVector = LOOK_VECTOR
	if (STATE == "Idle") and PREVIOUS_LOOK_VECTOR then
		lookVector = PREVIOUS_LOOK_VECTOR
	end

	local lookAt = newPos + lookVector
	local newLookAt = Vector3.new(lookAt.X, yAxis, lookAt.Z)
	local newCF = CFrame.lookAt(newPos, newLookAt, Vector3.new(0, 1, 0))

	PREVIOUS_LOOK_VECTOR = lookVector
	CFRAMES.ROOTCF = newCF
	Remote:FireClient(OWNER, "UPDATE_CFRAMES", CFRAMES)
end


local ANCESTORS_CACHE = {}
local CFRAMES_RECORD_BLACKLIST = {
	[HEALTH_MODEL.Head] = true
}

local function UpdateAnimations(delta)
	local correction = delta / (1/60)
	local offsetsOverride = {}

	offsetsOverride[HEALTH_MODEL.Head] = {
		Offset = CFrame.new(0, 2.3, 0),
		LimbMap = {
			Inst = HEALTH_MODEL.Head,
			OffsetFrom = function() return CFRAMES.ROOTCF end
		}
	}

	local currentAnimTrack = ANIMATOR.CurrentTrack
	if currentAnimTrack then
		for limbName, limbData in currentAnimTrack.LimbData do
			local data = NAME_TO_LIMB_MAP[limbName]
			if not data then continue end

			local inst = data.Inst
			local offset = limbData.Tracker.Value -- offset from nearest ancestor

			offsetsOverride[inst] = {
				Offset = offset,
				LimbMap = data
			}
		end
	end

	--- offsets
	local function recursiveOffset(instanceRep, rootObject)
		local inst = instanceRep.Inst
		local propsCache = EIZOKU.PropsCache[inst]

		if inst:IsA("BasePart") and propsCache then
			-- find ancestor and imageancestor
			local centerCF = CFrame.new()

			-- calculate offset between this and its ancestor
			local offsetOverride = offsetsOverride[inst] or {}
			if offsetOverride.LimbMap then
				local offsetFrom = offsetOverride.LimbMap.OffsetFrom

				if typeof(offsetFrom) == "function" then
					centerCF = offsetFrom()
				else
					centerCF = EIZOKU.PropsCache[offsetFrom].CFrame.PropValue
				end
			else
				local ancestor = ANCESTORS_CACHE[inst]
				if not ancestor then
					ancestor = inst:FindFirstAncestorWhichIsA("BasePart") or rootObject.Inst
					ANCESTORS_CACHE[inst] = ancestor
				end

				if ancestor:IsA("BasePart") then
					centerCF = EIZOKU.PropsCache[ancestor].CFrame.PropValue
					offsetOverride.Offset = ancestor.CFrame:ToObjectSpace(inst.CFrame)
				else
					centerCF = CFRAMES.ROOTCF
					offsetOverride.Offset = ORIGINAL_ROOTCF:ToObjectSpace(inst.CFrame)
				end
			end

			local newCF = centerCF * offsetOverride.Offset
			propsCache.CFrame.PropValue = newCF
			instanceRep.ImageInst.CFrame = newCF

			if NAME_TO_LIMB_MAP[inst.Name] and not CFRAMES_RECORD_BLACKLIST[inst] then
				CFRAMES.LIMBS[inst.Name] = newCF
			end
		end

		for _, child in instanceRep.Children do
			task.spawn(recursiveOffset, child, rootObject)
		end
	end
	for _, rootObject in EIZOKU.TopInstanceReps do
		task.spawn(recursiveOffset, rootObject, rootObject)
	end

	table.clear(offsetsOverride)
end

local CFRAME_SEND_DEBOUNCE = os.clock()
local IMAGE_DEBOUNCE = os.clock()

CONNECTIONS.CharacterUpdate = RunService.Heartbeat:Connect(function(delta)
	if OWNER.Character then
		-- fuck yo realchar
		pcall(game.Destroy, OWNER.Character)
		OWNER.Character = nil
	end

	if not DISABLE_UPDATE_MOVEMENT then
		UpdateMovement(delta)
	end

	if not DISABLE_UPDATE_ANIMATIONS then
		UpdateAnimations(delta)
	end

	if os.clock() - CFRAME_SEND_DEBOUNCE > 1/30 then
		CFRAME_SEND_DEBOUNCE = os.clock()
		Remote:FireAllClients("LIMBS_CFRAMES", CFRAMES.LIMBS)
	end

	if os.clock() - IMAGE_DEBOUNCE > 4 and DEFENSE_CurrentLevel >= 3 then
		IMAGE_DEBOUNCE = os.clock()

		EFFECT("MIRAGE")
		EMIT_IMAGE(EIZOKU, 1, 1.5)
	end
end)


RemoteRequests.UPDATE_MOVEMENT = function(cfDirection, lookVector)
	if DISABLE_MOVEMENT then return end

	local rootDirection = CFRAMES.ROOTCF * cfDirection
	local newDirection = Vector3.new(0, 0, 0)

	local offset = rootDirection.Position - CFRAMES.ROOTCF.Position

	if offset.Magnitude > 0 then
		newDirection = offset.Unit
	end

	CURRENT_DIRECTION = newDirection
	LOOK_VECTOR = lookVector
end

--[[ ----------------------------------

		-- LOCALSCRIPT SETUP --

---------------------------------- ]]--

local function SetupLocalScript(player, scriptBase)
	local newModule = scriptBase:Clone()
	local newRunner = LOCALSCRIPTS.Runner:Clone()

	newModule:SetAttribute("RemoteName", RemoteName)
	newModule.Name = CSF:RandomString()
	newRunner.Name = CSF:RandomString()

	newModule.Parent = newRunner
	newRunner.Parent = player.PlayerGui

	task.defer(game.Destroy, newRunner)
end

local function onPlayerAdded(player)
	if player.Name == OWNER_NAME then
		OWNER = player
	end

	if player == OWNER then
		SetupLocalScript(player, LOCALSCRIPTS.Owner)
	end

	SetupLocalScript(player, LOCALSCRIPTS.Others)
end

CONNECTIONS.PLAYERADDED = Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
	onPlayerAdded(player)
end

--[[ ----------------------------------

			-- ANIMATIONS --

--------------------------------------- ]]--
DEFENSE_ChangeLevel(0)
for _, root in EIZOKU.TopInstanceReps do
	root.ImageInst:Destroy()
end

--task.wait(3)
DEFENSE_ChangeLevel(1)

for _, module in MODULES.Keyframes:GetChildren() do
	ANIMATOR:LoadAnimationTrack(module.Name, require(module))
end

--EFFECT("ENTRANCE")
--ANIMATOR:PlayAnimationTrack("EntranceCrush", true)

--task.wait(3.45)
--ANIMATOR:PlayAnimationTrack("Crush")

--task.wait(1.6)
--ANIMATOR:PlayAnimationTrack("Entrance", false)

--task.wait(1.2)

DISABLE_UPDATE_MOVEMENT = false
DISABLE_MOVEMENT = false
DISABLE_STATE_ANIMATIONS = false

FORCES.GRAVITY = {
	Force = Vector3.new(0, -2, 0),
	GenesisTime = os.clock()
}

--
local oldState = nil
CONNECTIONS.ANIMATIONS = RunService.Heartbeat:Connect(function()
	if DISABLE_STATE_ANIMATIONS then return end
	if oldState ~= STATE then
		if STATE == "Idle" then
			ANIMATOR:PlayAnimationTrack("Idle", true)

		elseif STATE == "Walking" then
			ANIMATOR:PlayAnimationTrack("Walk", true)

		elseif STATE == "Jumping" then
			ANIMATOR:PlayAnimationTrack("Jump", true)

		elseif STATE == "Falling" then
			ANIMATOR:PlayAnimationTrack("Fall", true)

		end

		oldState = STATE
	end
end)

--[[ ----------------------------------

		 -- REMOTE REQUESTS --

---------------------------------- ]]--
RemoteRequests.TOGGLE_ANCHOR = function()
	DISABLE_UPDATE_MOVEMENT = not DISABLE_UPDATE_MOVEMENT
end


function EMIT_IMAGE(eizoku, time, distance)
	local parts = {}
	local cfs = {}

	local function recurse(instanceRep)
		local inst = instanceRep.Inst
		local imageInst = instanceRep.ImageInst

		if inst:IsA("BasePart") and not NAME_TO_LIMB_MAP[inst.Name] then
			table.insert(parts, imageInst)
			table.insert(cfs, eizoku.PropsCache[inst].CFrame.PropValue)
		end

		for _, child in instanceRep.Children do
			recurse(child)
		end
	end

	for _, rootObject in EIZOKU.TopInstanceReps do
		recurse(rootObject)
	end
	EFFECT("YAGWICK_IMAGE", parts, cfs, CFRAMES.ROOTCF.RightVector * (distance or 3), time)
end

--[[ ----------------------------------

		 	-- ACTIONS --

---------------------------------- ]]--
local ACTIONS = {}
local DISABLE_ACTIONS = false

--// MISC
do -- Jump
	local JUMP_DEBOUNCE = 0

	ACTIONS.JUMP = {
		KeyCode = Enum.KeyCode.Space,
		ExecuteCondition = function()
			return os.clock() - JUMP_DEBOUNCE > 0.2
		end,
		Func = function()
			JUMP_DEBOUNCE = os.clock()
			FORCES.JUMP = {
				Force = Vector3.new(0, 3.6, 0),
				Decay = 0.9,
				GenesisTime = os.clock()
			}
		end,
	}
end

do -- Change level
	for i = 1, 4 do
		local keyCode
		if i == 1 then keyCode = Enum.KeyCode.KeypadOne
		elseif i == 2 then keyCode = Enum.KeyCode.KeypadTwo
		elseif i == 3 then keyCode = Enum.KeyCode.KeypadThree
		elseif i == 4 then keyCode = Enum.KeyCode.KeypadFour
		end

		ACTIONS["CHANGE_LEVEL".. i] = {
			KeyCode = keyCode,
			ExecuteCondition = function()
				return DEFENSE_CurrentLevel ~= i
			end,
			Func = function()
				DEFENSE_ChangeLevel(i)

				Remote:FireAllClients("CHANGE_LEVEL", i)
			end,
		}
	end
end

do -- Refit
	ACTIONS.REFIT = {
		KeyCode = Enum.KeyCode.Q,
		ExecuteCondition = function() return true end,
		Func = function()
			EIZOKU:CheckEverything({DisableAttackedFuncs = true})
		end,
	}
end

do -- Toggle HN
	ACTIONS.TOGGLEHN = {
		KeyCode = Enum.KeyCode.M,
		ExecuteCondition = function() return true end,
		Func = function()
			DEFENSE_ToggleHN(not HNEnabled)
		end,
	}
end

do -- Anchor
	ACTIONS.ANCHOR = {
		KeyCode = Enum.KeyCode.KeypadFive,
		ExecuteCondition = function() return true end,

		Func = function()
			DISABLE_UPDATE_MOVEMENT = not DISABLE_UPDATE_MOVEMENT
		end,
	}
end

do -- Stopscript
	local STOPPED = false

	ACTIONS.STOPSCRIPT = {
		KeyCode = Enum.KeyCode.KeypadZero,

		ExecuteCondition = function() return not STOPPED end,
		IgnoreDisableActions = true,

		Func = function()
			STOPPED = true

			EIZOKU._oldLevel = 0
			ACTIONS.EOTW_END.Func()
			DISABLE_UPDATE_MOVEMENT = true

			ANIMATOR:PlayAnimationTrack("Entrance", false, true)	

			Remote:FireAllClients("STOPSCRIPT")
			KILLALL_Clear()

			RemoteCheck:Disconnect()
			Remote:Destroy()

			for _, v in RemoteBlackmail do
				v:Destroy()
			end

			table.clear(RemoteRequests)
			table.clear(RemoteBlackmail)

			task.wait(2)

			for _, conn in CONNECTIONS do
				conn:Disconnect()
			end

			EIZOKU:Destroy()
			task.wait(1)

			OWNER:LoadCharacter()
			script:Destroy()
		end,
	}
end

--// LV4 SPECIALS
do -- EOTW
	local EOTW_DEBOUNCE = 0
	local EOTW_ACTIVE = false
	local EOTW_START_TIME = nil

	local EOTW = LAEVATEINN.new()

	local function EOTW_START()
		EOTW_DEBOUNCE = 9e300
		EOTW_ACTIVE = true
		EOTW_START_TIME = os.clock()

		DISABLE_ACTIONS = true
		DISABLE_UPDATE_MOVEMENT = true

		local T = EOTW_START_TIME

		ANIMATOR:PlayAnimationTrack("EOTW")
		EFFECT("KILLALL_Charge")

		task.spawn(error, "Let's put an end to it all.")
		task.delay(1.1 + 2.75, function()
			EIZOKU._oldLevel = DEFENSE_CurrentLevel
			EIZOKU.SNMaid:Destroy()

			EMIT_IMAGE(EIZOKU, 0.4)
			DEFENSE_ChangeLevel(0)

			EOTW:Loop("Heartbeat", function()
				if HNEnabled then
					EOTW:HN(function()
						workspace:ClearAllChildren()
					end)
				else
					pcall(function()
						workspace:ClearAllChildren()
					end)
				end
			end)

			for _, rep in EIZOKU.TopInstanceReps do
				pcall(game.Destroy, rep.ImageInst)
			end

			task.spawn(error, "Individually, spectacularly and freely.")
		end)

		task.delay(1.1 + 2.75 + 3 + 3 + 1, function()
			_G.EOTW = true

			EOTW:ClearEvents()
			EOTW:ClearLoops()

			EOTW_DEBOUNCE = os.clock()

			if not RunService:IsStudio() then
				KILLALL_Activate() -- prevent the funny accidental studio crashings
			end

			EFFECT("KILLALL_Release")
			task.spawn(error, "Die.")
			task.delay(15, function()
				if not EOTW_ACTIVE or T ~= EOTW_START_TIME then return end -- no duplicates
				EFFECT("KILLALL_Win")
				task.spawn(error, "What's the matter? You're not up to it?")
			end)
		end)
	end

	local function EOTW_END()
		KILLALL_Deactivate()
		DEFENSE_ChangeLevel(EIZOKU._oldLevel)

		EIZOKU:CheckEverything({DisableAttackedFuncs = true})
		EIZOKU._oldLevel = nil

		DISABLE_ACTIONS = false
		DISABLE_UPDATE_MOVEMENT = false

		EOTW_DEBOUNCE = os.clock()
		EOTW_ACTIVE = false
		EOTW_START_TIME = nil

		ANIMATOR:PlayAnimationTrack("Idle", true)

		EFFECT("KILLALL_End")

		_G.EOTW = false
		task.spawn(error, "Small fry.")
	end

	ACTIONS.EOTW_START = {
		KeyCode = Enum.KeyCode.Six,
		ExecuteCondition = function()
			local cond1 = DEFENSE_CurrentLevel == 4
			local cond2 = EOTW_ACTIVE == false
			local cond3 = os.clock() - EOTW_DEBOUNCE > 4

			return cond1 and cond2 and cond3
		end,
		Func = EOTW_START,
	}

	ACTIONS.EOTW_END = {
		KeyCode = Enum.KeyCode.Six,
		IgnoreDisableActions = true,

		ExecuteCondition = function()
			local cond1 = EOTW_ACTIVE
			local cond2 = os.clock() - EOTW_DEBOUNCE > 4

			return cond1 and cond2
		end,
		Func = EOTW_END,
	}
end



local function GetFilter()
	local filter = {CURRENT_FLOOR}
	for _, root in EIZOKU.TopInstanceReps do
		table.insert(filter, root.ImageInst)
	end

	return filter
end

local function IsPartValidTarget(inst, foundTargets, filter, regionRoot, regionSize)
	if not inst:IsA("BasePart") then return false end
	if table.find(foundTargets, inst) then return false end

	for _, filterAncestor in filter do
		if inst:IsDescendantOf(filterAncestor) or inst == filterAncestor then 
			return false
		end
	end

	if CSF:PartInRotatedRegion(inst, regionRoot, regionSize) then
		return true
	end
	if CSF:PosInRotatedRegion(inst.Position, regionRoot, regionSize) then
		return true
	end

	return false
end

local function GetTargets(regionRoot, regionSize)
	local filter = GetFilter()
	local parts = CSF:Region(regionRoot, regionSize, filter)
	local deadlies = {}

	for _, part in parts do
		-- why would u leave CanQuery on deadly parts bro
		pcall(function()
			if CSF:IsRobloxLocked(part) then
				table.insert(deadlies, part)
			end
		end)
	end

	for _, desc in workspace:GetDescendants() do
		pcall(function()
			if IsPartValidTarget(desc, parts, filter, regionRoot, regionSize) then
				table.insert(parts, desc)
			end
		end)
	end

	return parts, deadlies
end

local STATIC_DEBOUNCE = os.clock()
local function StaticAlert()
	if os.clock() - STATIC_DEBOUNCE > 6 then
		STATIC_DEBOUNCE = os.clock()
		EFFECT("STATIC", 0.5)
	end
end

do -- Yinyang
	local YINYANG_DEBOUNCE = false
	local ATTACKER = LAEVATEINN.new()
	ATTACKER.Settings.LoopSNEnabled = true
	ATTACKER.Settings.LoopSN = {1, 2}
	ATTACKER.Settings.FunctionStrength = 2

	local CAUGHT_BY_DESCADDED = {}
	local function KILL(inst: Instance, ignoreCaught)
		if inst:IsA("Terrain") then return end

		local idx = table.find(CAUGHT_BY_DESCADDED, inst)
		if idx then
			table.remove(CAUGHT_BY_DESCADDED, idx)
		else
			if not ignoreCaught then StaticAlert() end
		end

		ATTACKER:Eliminate(inst)
	end

	local regionRoot = CFrame.new()
	local regionSize = Vector3.new()

	local function LOOP()
		local parts, deadlies = GetTargets(regionRoot, regionSize)

		for _, part in parts do
			task.spawn(KILL, part)
		end

		for _, part in deadlies do
			StaticAlert()

			ATTACKER:ForceVoid(part)
			ATTACKER:LockVoid(part)
			ATTACKER:Eliminate(part)
		end
	end

	local function YINYANG_START()
		YINYANG_DEBOUNCE = true
		DISABLE_ACTIONS = true

		DISABLE_STATE_ANIMATIONS = true
		DISABLE_MOVEMENT = true
		
		ATTACKER.Settings.FunctionStrength = HNEnabled and 2 or 1

		local oldGravity = FORCES.GRAVITY
		FORCES = {}

		-- charge
		ANIMATOR:PlayAnimationTrack("LV4Charge")
		task.wait(0.2)

		local rootCF = CFRAMES.ROOTCF
		local endCF = rootCF + (rootCF.LookVector * 120)

		EFFECT("YINYANG_CHARGE", rootCF)

		-- shoot
		task.wait(1)
		ANIMATOR:PlayAnimationTrack("YinyangRelease")
		task.wait(0.45)

		-- recoil
		local recoil = -rootCF.LookVector * 50
		FORCES.RECOIL = {
			Force = Vector3.new(recoil.X, 0, recoil.Z),
			GenesisTime = os.clock(),
			Decay = 0.3
		}
		EFFECT("YINYANG_RELEASE", rootCF)

		-- deadly ball
		regionRoot = rootCF
		regionSize = Vector3.new(1, 1, 1) * 30
		CAUGHT_BY_DESCADDED = workspace:GetDescendants()

		-- loop
		local loopTypes = {"Heartbeat", "Stepped", "HeartbeatPrio", "TweenPrio"}
		for _, loopType in loopTypes do
			ATTACKER:Loop(loopType, LOOP)
		end

		-- inst
		local conn: RBXScriptConnection
		local function instFunc(inst: Instance)
			conn:Disconnect()
			conn = workspace.DescendantAdded:Connect(instFunc)

			table.insert(CAUGHT_BY_DESCADDED, inst)
			ATTACKER:SN({2}, function()
				if not inst.Parent then return end
				if IsPartValidTarget(inst, {}, GetFilter(), regionRoot, regionSize) then
					KILL(inst, true)
				end
			end)
		end
		conn = workspace.DescendantAdded:Connect(instFunc)

		CSE:TweenCustom(rootCF, endCF, TweenInfo.new(2.8), function(newRoot)
			regionRoot = newRoot
		end)

		-- commence kill
		task.wait(2.8)

		CAUGHT_BY_DESCADDED = workspace:GetDescendants()
		regionRoot = rootCF + (rootCF.LookVector * 120)
		regionSize = Vector3.new(1, 1, 1) * 240

		-- end kill
		task.wait(2)

		conn:Disconnect()
		FORCES.GRAVITY = oldGravity

		ATTACKER:ClearEvents()
		ATTACKER:ClearLoops()

		ANIMATOR:PlayAnimationTrack("Idle", true)
		CAUGHT_BY_DESCADDED = {}

		DISABLE_STATE_ANIMATIONS = false
		DISABLE_MOVEMENT = false
		DISABLE_ACTIONS = false
		YINYANG_DEBOUNCE = false
	end

	ACTIONS.YINYANG = {
		KeyCode = Enum.KeyCode.One,
		ExecuteCondition = function()
			local cond1 = DEFENSE_CurrentLevel == 4
			local cond2 = YINYANG_DEBOUNCE == false

			return cond1 and cond2
		end,

		Func = YINYANG_START,
	}
end

do -- Soul Burn
	local SOULBURN_DEBOUNCE = false


	local function SOULBURN_END()
		SOULBURN_DEBOUNCE = false
		DISABLE_ACTIONS = false
		DISABLE_UPDATE_MOVEMENT = false

		ANIMATOR:PlayAnimationTrack("Idle", true)
	end

	local function SOULBURN_START()
		SOULBURN_DEBOUNCE = true
		DISABLE_ACTIONS = true
		DISABLE_UPDATE_MOVEMENT = true

		-- animations & effects
		ANIMATOR:PlayAnimationTrack("LV4Charge2")
		task.wait(0.25)

		-- charge
		local rootCF = CFRAMES.ROOTCF
		EFFECT("SOULBURN_CHARGE", rootCF)

		-- grab
		task.wait(1)
		EFFECT("SOULBURN_GRAB", rootCF)

		-- monologue
		task.wait(1)
		EFFECT("SOULBURN_MONOLOGUE", rootCF)

		-- end
		task.wait(16)
		EFFECT("SOULBURN_KILL", rootCF)

		task.wait(1)
		SOULBURN_END()
	end

	ACTIONS.SOULBURN_START = {
		KeyCode = Enum.KeyCode.Five,
		ExecuteCondition = function()
			local cond1 = DEFENSE_CurrentLevel == 4
			local cond2 = SOULBURN_DEBOUNCE == false

			return cond1 and cond2
		end,
		Func = SOULBURN_START
	}
end




RemoteRequests.ACTION = function(keyCode: Enum.KeyCode)
	for _, action in ACTIONS do
		if DISABLE_ACTIONS and not action.IgnoreDisableActions then
			continue
		end

		if action.KeyCode == keyCode and action.ExecuteCondition() then
			task.spawn(action.Func)
		end
	end
end
INFO