Prompt: --// Core

Response:
return function(Vargs, GetEnv)
	local env = GetEnv(nil, {script = script})
	setfenv(1, env)

	local server = Vargs.Server;
	local service = Vargs.Service;

	local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Deps;
	local AddLog, Queue, TrackTask
	local logError = env.logError
	local function Init(data)
		Functions = server.Functions;
		Admin = server.Admin;
		Anti = server.Anti;
		Core = server.Core;
		HTTP = server.HTTP;
		Logs = server.Logs;
		Remote = server.Remote;
		Process = server.Process;
		Variables = server.Variables;
		Settings = server.Settings;
		Deps = server.Deps;

		AddLog = Logs.AddLog;
		Queue = service.Queue;
		TrackTask = service.TrackTask;
		logError = logError or env.logError;

		--// Core variables
		Core.Themes = data.Themes or {}
		Core.Plugins = data.Plugins or {}
		Core.ModuleID = data.ModuleID or 7510592873
		Core.LoaderID = data.LoaderID or 7510622625
		Core.DebugMode = data.DebugMode or false
		Core.Name = Functions:GetRandom()
		Core.LoadstringObj = Core.GetLoadstring()
		Core.Loadstring = require(Core.LoadstringObj)

		service.DataStoreService = require(Deps.MockDataStoreService)(Settings.LocalDatastore)

		local function disableAllGuis(folder: Folder)
			for _, v in folder:GetChildren() do
				if v:IsA("ScreenGui") then
					v.Enabled = false
				elseif v:IsA("Folder") or v:IsA("Model") then
					disableAllGuis(v)
				end
			end
		end
		disableAllGuis(server.Client.UI)

		Core.Init = nil;
		AddLog("Script", "Core Module Initialized")
	end;

	local function RunAfterPlugins(data)
		--// RemoteEvent Handling
		Core.MakeEvent()

		--// Prepare the client loader
		--local existingPlayers = service.Players:GetPlayers();
		--Core.MakeClient()

		local remoteParent = service.ReplicatedStorage;
		remoteParent.ChildRemoved:Connect(function(c)
			task.wait(1/60)

			if server.Core.RemoteEvent and not Core.FixingEvent and (function() for i,v in Core.RemoteEvent do if c == v then return true end end end)() then
				Core.MakeEvent()
			end
		end)

		--// Load data
		Core.DataStore = Core.GetDataStore()
		if Core.DataStore then
			TrackTask("Thread: DSLoadAndHook", function()
				--// Catch any errors and print it to the console; allow for debugging.
				task.defer(env.Pcall, Core.LoadData)
			end)
		end

		--// Start API
		if service.NetworkServer then
			--service.Threads.RunTask("_G API Manager",server.Core.StartAPI)
			TrackTask("Thread: API Manager", Core.StartAPI)
		end

		--// Occasionally save all player data to the datastore to prevent data loss if the server abruptly crashes
		service.StartLoop("SaveAllPlayerData", Core.DS_AllPlayerDataSaveInterval, Core.SaveAllPlayerData, true)

		Core.RunAfterPlugins = nil;
		AddLog("Script", "Core Module RunAfterPlugins Finished");
	end

	server.Core = {
		Init = Init;
		RunAfterPlugins = RunAfterPlugins;
		DataQueue = {};
		DataCache = {};
		PlayerData = {};
		CrossServerCommands = {};
		CrossServer = function(...) return false end;
		ExecuteScripts = {};
		LastDataSave = 0;
		FixingEvent = false;
		ScriptCache = {};
		Connections = {};
		BytecodeCache = {};
		LastEventValue = 1;
		SavedPlayerData = {};

		Variables = {
			TimeBans = {};
		};

		--// Datastore update/queue timers/delays
		DS_WriteQueueDelay = 1;
		DS_ReadQueueDelay = 0.5;
		DS_AllPlayerDataSaveInterval = 30;
		DS_AllPlayerDataSaveQueueDelay = 0.5;

		--// Used to change/"reset" specific datastore keys
		DS_RESET_SALTS = {
			SavedSettings = "32K5j4";
			SavedTables = 	"32K5j4";
		};

		DS_BLACKLIST = {
			Trello_Enabled = true;
			Trello_Primary = true;
			Trello_Secondary = true;
			Trello_Token = true;
			Trello_AppKey = true;

			DataStore = true;
			DataStoreKey = true;
			DataStoreEnabled = true;
			LocalDatastore = true;

			Creators = true;
			Permissions = true;

			G_API = true;
			G_Access = true;
			G_Access_Key = true;
			G_Access_Perms = true;
			Allowed_API_Calls = true;

			LoadAdminsFromDS = true;

			WebPanel_ApiKey = true;
			WebPanel_Enabled = true;

			["Settings.Ranks.Creators.Users"] = true;
			["Admin.SpecialLevels"] = true;

			OnStartup = true;
			OnSpawn = true;
			OnJoin = true;

			CustomRanks = true;
			Ranks = true;
			Commands = true;

			--// Not gonna let malicious stuff set DS_Blacklist to {} or anything!
			DS_BLACKLIST = true;
		};

		--// Prevent certain keys from loading from the DataStore
		PlayerDataKeyBlacklist = {
			AdminRank = true;
			AdminLevel = true;
			LastLevelUpdate = true;
		};

		UpdatePlayerConnection = function(p)
			for i, cli in next,service.NetworkServer:GetChildren() do
				if cli:GetPlayer() == p then
					Core.Connections[cli] = p
				end
			end
		end;

		DisconnectEvent = function()
			if Core.RemoteEvent and not Core.FixingEvent then
				Core.FixingEvent = true

				for name,event in Core.RemoteEvent.Events do
					event:Disconnect()
				end

				pcall(function() service.Delete(Core.RemoteEvent.Object) end)
				pcall(function() service.Delete(Core.RemoteEvent.Function) end)

				Core.FixingEvent = false
				Core.RemoteEvent = nil
			end
		end;

		MakeEvent = function()
			local remoteParent = service.ReplicatedStorage
			local ran, err = pcall(function()
				if server.Running then
					local rTable = {};
					local event = service.New("RemoteEvent", {Name = Core.Name, Archivable = false}, true, true)
					local func = service.New("RemoteFunction", {Name = "__FUNCTION", Parent = event}, true, true)
					local secureTriggered = true
					local tripDet = math.random()

					local function secure(ev, name, parent)
						return ev.Changed:Connect(function()
							if Core.RemoteEvent == rTable and not secureTriggered then
								if ev == func then
									func.OnServerInvoke = Process.Remote
								end

								if ev.Name ~= name then
									ev.Name = name
								elseif ev.Parent ~= parent then
									secureTriggered = true;
									Core.DisconnectEvent();
									Core.MakeEvent()
								end
							end
						end)
					end

					Core.DisconnectEvent()
					Core.TripDet = tripDet

					rTable.Events = {}
					rTable.Object = event
					rTable.Function = func

					rTable.Events.Security = secure(event, event.Name, remoteParent)
					rTable.Events.FuncSec = secure(func, func.Name, event)

					func.OnServerInvoke = Process.Remote;
					rTable.Events.ProcessEvent = service.RbxEvent(event.OnServerEvent, Process.Remote)

					Core.RemoteEvent = rTable
					event.Parent = remoteParent
					secureTriggered = false

					AddLog(Logs.Script, {
						Text = "Created RemoteEvent";
						Desc = "RemoteEvent was successfully created";
					})
				end
			end)

			if err then
				warn(err)
			end
		end;

		UpdateConnections = function()
			if service.NetworkServer then
				for _, cli in service.NetworkServer:GetChildren() do
					if cli:IsA("NetworkReplicator") then
						Core.Connections[cli] = cli:GetPlayer()
					end
				end
			end
		end;

		UpdateConnection = function(p)
			if service.NetworkServer then
				for _, cli in service.NetworkServer:GetChildren() do
					if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
						Core.Connections[cli] = p
					end
				end
			end
		end;

		GetNetworkClient = function(p)
			if service.NetworkServer then
				for _, cli in service.NetworkServer:GetChildren() do
					if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
						return cli
					end
				end
			end
		end;

		MakeClient = function(parent)
			if not parent and Core.ClientLoader then
				local loader = Core.ClientLoader
				loader.Removing = true

				for _, v in loader.Events do
					v:Disconnect()
				end

				loader.Object:Destroy()
			end;

			local depsName = Functions:GetRandom()
			local folder = server.Client:Clone()
			local acli = Deps.ClientMover:Clone();
			local client = folder.Client
			local parentObj = parent or service.StarterPlayer:FindFirstChildOfClass("StarterPlayerScripts");
			local clientLoader = {
				Removing = false;
			};

			Core.MockClientKeys = Core.MockClientKeys or {
				Special = depsName;
				Module = client;
			}

			local depsName = Core.MockClientKeys.Special;
			local specialVal = service.New("StringValue")
			specialVal.Value = `{Core.Name}\\{depsName}`
			specialVal.Name = "Special"
			specialVal.Parent = folder

			acli.Parent = folder;
			acli.Disabled = false;

			folder.Archivable = false;
			folder.Name = depsName; --"Adonis_Client"
			folder.Parent = parentObj;

			if not parent then
				local oName = folder.Name
				clientLoader.Object = folder
				clientLoader.Events = {}

				clientLoader.Events[folder] = folder.Changed:Connect(function()
					if Core.ClientLoader == clientLoader and not clientLoader.Removing then
						if folder.Name ~= oName then
							folder.Name = oName;
						elseif folder.Parent ~= parentObj then
							clientLoader.Removing = true
							Core.MakeClient()
						end
					end
				end)

				for _, child in folder:GetDescendants() do
					local oParent = child.Parent
					local oName = child.Name

					clientLoader.Events[child.Changed] = child.Changed:Connect(function(c)
						if Core.ClientLoader == clientLoader and not clientLoader.Removing then
							if child.Parent ~= oParent or child == specialVal then
								Core.MakeClient()
							end
						end
					end)

					local nameEvent = child:GetPropertyChangedSignal("Name"):Connect(function()
						if Core.ClientLoader == clientLoader and not clientLoader.Removing then
							child.Name = oName
						end
					end)

					clientLoader.Events[nameEvent] = nameEvent
					clientLoader.Events[child.AncestryChanged] = child.AncestryChanged:Connect(function()
						if Core.ClientLoader == clientLoader and not clientLoader.Removing then
							Core.MakeClient()
						end
					end)
				end

				folder.DescendantAdded:Connect(function(d)
					if Core.ClientLoader == clientLoader and not clientLoader.Removing then
						Core.MakeClient()
					end
				end)

				folder.DescendantRemoving:Connect(function(d)
					if Core.ClientLoader == clientLoader and not clientLoader.Removing then
						Core.MakeClient()
					end
				end)

				Core.ClientLoader = clientLoader
			end

			local ok,err = pcall(function()
				folder.Parent = parentObj
			end)

			clientLoader.Removing = false;

			AddLog("Script", "Created client")
		end;

		HookClient = function(p)
			local key = tostring(p.UserId)
			local keys = Remote.Clients[key]
			if keys then
				local depsName = Functions:GetRandom()
				local eventName = Functions:GetRandom()
				local folder = server.Client:Clone()
				local acli = Deps.ClientMover:Clone();
				local client = folder.Client
				local parentTo = "PlayerGui" --// Roblox, seriously, please give the server access to PlayerScripts already so I don't need to do this.
				local parentObj = p:FindFirstChildOfClass(parentTo) or p:WaitForChild(parentTo, 600);

				if not p.Parent then
					return false
				elseif not parentObj then
					p:Kick("\n[CLI-102495] Loading Error \nPlayerGui Missing (Waited 10 Minutes)")
					return false
				end

				local container = service.New("ScreenGui");
				container.ResetOnSpawn = false;
				container.Enabled = false;
				container.Name = "\0";

				local specialVal = service.New("StringValue")
				specialVal.Value = `{Core.Name}\\{depsName}`
				specialVal.Name = "Special"
				specialVal.Parent = folder

				keys.Special = depsName
				keys.EventName = eventName
				keys.Module = client

				acli.Parent = folder;
				acli.Disabled = false;

				folder.Name = "Adonis_Client"
				folder.Parent = container;

				--// Event only fires AFTER the client is alive and well
				local event; event = service.Events.ClientLoaded:Connect(function(plr)
					if p == plr and container.Parent == parentObj then

						--container:Destroy(); -- Destroy update causes an issue with this pretty sure
						container.Parent = nil
						local leaveEvent; leaveEvent = p.AncestryChanged:Connect(function() -- after/on remove, not on removing...
							task.wait()
							if p.Parent == nil then
								-- Prevent potential memory leak and ensure this gets properly murdered when they leave and it's no longer needed
								pcall(function()
									container:Destroy()
								end)
							end
						end)

						leaveEvent:Disconnect()
						leaveEvent = nil
						event:Disconnect();
						event = nil
					end
				end)

				local ok, err = pcall(function()
					container.Parent = parentObj
				end)

				if not ok then
					p:Kick(`\n[CLI-192385] Loading Error \n[HookClient Error: {err}]`)
					return false
				else
					return true
				end
			else
				if p and p.Parent then
					p:Kick("\n[CLI-5691283] Loading Error \n[HookClient: Keys Missing]")
				end
			end
		end;

		LoadClientLoader = function(p)
			local loader = Deps.ClientLoader:Clone()
			loader.Name = Functions.GetRandom()
			loader.Parent = p:WaitForChild("PlayerGui", 60) or p:WaitForChild("Backpack")
			loader.Disabled = false
		end;

		LoadExistingPlayer = function(p)
			warn(`Loading existing player: {p}`)

			TrackTask(`Thread: Setup Existing Player: {p}`, function()
				Process.PlayerAdded(p)
				--Core.MakeClient(p:FindFirstChildOfClass("PlayerGui") or p:WaitForChild("PlayerGui", 120))
			end)
		end;

		ExecutePermission = function(scr, code, isLocal)
			local fixscr = service.UnWrap(scr)

			for _, val in Core.ExecuteScripts do
				if not isLocal or (isLocal and val.Type == "LocalScript") then
					if (service.UnWrap(val.Script) == fixscr or code == val.Code) and (not val.runLimit or (val.runLimit ~= nil and val.Executions <= val.runLimit)) then
						val.Executions += 1

						return {
							Source = val.Source;
							noCache = val.noCache;
							runLimit = val.runLimit;
							Executions = val.Executions;
						}
					end
				end
			end
		end;

		GetScript = function(scr, code)
			for i, val in Core.ExecuteScripts do
				if val.Script == scr or code == val.Code then
					return val, i
				end
			end
		end;

		UnRegisterScript = function(scr)
			for i, dat in Core.ExecuteScripts do
				if dat.Script == scr or dat == scr then
					table.remove(Core.ExecuteScripts, i)
					return dat
				end
			end
		end;

		RegisterScript = function(data)
			data.Executions = 0
			data.Time = os.time()
			data.Type = data.Script.ClassName
			data.Wrapped = service.Wrap(data.Script)
			data.Wrapped:SetSpecial("Clone",function()
				return Core.RegisterScript({
					Script = service.UnWrap(data.Script):Clone();
					Code = data.Code;
					Source = data.Source;
					noCache = data.noCache;
					runLimit = data.runLimit;
				})
			end)

			for ind,scr in Core.ExecuteScripts do
				if scr.Script == data.Script then
					return scr.Wrapped or scr.Script
				end
			end

			if not data.Code then
				data.Code = Functions.GetRandom()
			end

			table.insert(Core.ExecuteScripts, data)
			return data.Wrapped
		end;

		GetLoadstring = function()
			local newLoad = Deps.Loadstring:Clone()
			local lbi = server.Shared.FiOne:Clone()

			lbi.Parent = newLoad

			return newLoad
		end;

		Bytecode = function(str: string)
			if Core.BytecodeCache[str] then return Core.BytecodeCache[str] end
			local f, buff = Core.Loadstring(str)
			Core.BytecodeCache[str] = buff
			return buff
		end;

		NewScript = function(scriptType: string, source: string, allowCodes: boolean?, noCache: boolean?, runLimit: number?)
			local scr = assert(
				if scriptType == "Script" then Deps.ScriptBase:Clone()
					elseif scriptType == "LocalScript" then Deps.LocalScriptBase:Clone()
					else nil,
				`Invalid script type '{scriptType}'`
			)

			local execCode = Functions.GetRandom()

			scr.Name = `[Adonis] {scriptType}`

			if allowCodes then
				service.New("StringValue", {
					Name = "Execute",
					Value = execCode,
					Parent = scr,
				})
			end

			local wrapped = Core.RegisterScript({
				Script = scr;
				Code = execCode;
				Source = Core.Bytecode(source);
				noCache = noCache;
				runLimit = runLimit;
			})

			return wrapped or scr, scr, execCode
		end;

		SavePlayer = function(p, data)
			local key = tostring(p.UserId)
			Core.PlayerData[key] = data
		end;

		DefaultPlayerData = function(p)
			return {
				Donor = {
					Cape = {
						Image = "0";
						Color = "White";
						Material = "Neon";
					};
					Enabled = false;
				};
				Banned = false;
				TimeBan = false;
				AdminNotes = {};
				Keybinds = {};
				Aliases = {};
				Client = {};
				Warnings = {};
			}
		end;

		GetPlayer = function(p)
			local key = tostring(p.UserId)

			if not Core.PlayerData[key] then
				local PlayerData = Core.DefaultPlayerData(p)

				Core.PlayerData[key] = PlayerData

				if Core.DataStore and p.UserId > 0 then
					local data = Core.GetData(key)
					if type(data) == "table" then
						data.AdminNotes = if data.AdminNotes then Functions.DSKeyNormalize(data.AdminNotes, true) else {}
						data.Warnings = if data.Warnings then Functions.DSKeyNormalize(data.Warnings, true) else {}

						local BLOCKED_SETTINGS = Core.PlayerDataKeyBlacklist
						for i, v in data do
							if not BLOCKED_SETTINGS[i] then
								PlayerData[i] = v
							end
						end

						Core.SavedPlayerData[p.UserId] = service.DeepCopy(data)
					end
				end

				return PlayerData
			else
				return Core.PlayerData[key]
			end
		end;

		ClearPlayer = function(p)
			Core.PlayerData[tostring(p.UserId)] = Core.DefaultData(p)
		end;

		SavePlayerData = function(p, customData)
			local key = tostring(p.UserId)
			local pData = customData or Core.PlayerData[key]

			if Core.DataStore then
				if pData and p.UserId > 0 then
					local data = service.DeepCopy(pData)

					--// Temporary junk that will be removed on save.
					for _, blacklistedData in ipairs({"LastChat", "AdminRank", "AdminLevel", "LastLevelUpdate", "LastDataSave"}) do
						data[blacklistedData] = nil
					end

					--// We want to only save data if actual user data is different
					local CompareOptions = {
						IgnoreKeys = {"Groups", "AdminLevel", "AdminRank", "LastLevelUpdate", "LastDataSave"}
					}

					data.AdminNotes = Functions.DSKeyNormalize(data.AdminNotes)
					data.Warnings = Functions.DSKeyNormalize(data.Warnings)

					if Core.SavedPlayerData[p.UserId] and Functions.LaxCheckMatch(Core.SavedPlayerData[p.UserId], data, CompareOptions) and Functions.LaxCheckMatch(data, Core.SavedPlayerData[p.UserId], CompareOptions) then
						AddLog(Logs.Script, {
							Text = "Didn't save data due to redundancy ".. p.Name;
							Desc = "Player data was not saved to the datastore due to it being already saved.";
						})
					elseif not Functions.LaxCheckMatch(Core.DefaultPlayerData(p), data, CompareOptions) or Core.SavedPlayerData[p.UserId] and not (Functions.LaxCheckMatch(Core.SavedPlayerData[p.UserId], data, CompareOptions) or Functions.LaxCheckMatch(data, Core.SavedPlayerData[p.UserId], CompareOptions)) then
						Core.SetData(key, data)
						Core.SavedPlayerData[p.UserId] = data
						AddLog(Logs.Script, {
							Text = `Saved data for {p.Name}`;
							Desc = "Player data was saved to the datastore";
						})
					else
						AddLog(Logs.Script, {
							Text = `Didn't save default data for {p.Name}`;
							Desc = "Player data was not saved to the datastore due to it having default values";
						})
					end

					pData.LastDataSave = os.time()
				end
			end
		end;

		SaveAllPlayerData = function(queueWaitTime)
			local TrackTask = service.TrackTask
			for key,pdata in Core.PlayerData do
				local id = tonumber(key);
				local player = id and service.Players:GetPlayerByUserId(id);
				if player and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval)  then
					TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player);
				end
			end
			--[[ --// OLD METHOD (Kept in case this messes anything up)
			for i,p in service.Players:GetPlayers() do
				local pdata = Core.PlayerData[tostring(p.UserId)];
				--// Only save player's data if it has not been saved within the last INTERVAL (default 30s)
				if pdata and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
					service.Queue("SavePlayerData", function()
						Core.SavePlayerData(p)
						task.wait(queueWaitTime or Core.DS_AllPlayerDataSaveQueueDelay)
					end)
				end
			end--]]
		end;
		GetDataStore = function()
			local ran,store = pcall(function()

				return service.DataStoreService:GetDataStore(string.sub(Settings.DataStore, 1, 50),"Adonis")
			end)

			-- DataStore studio check.
			if ran and store and service.RunService:IsStudio() then
				local success, res = pcall(store.GetAsync, store, math.random())
				if not success and string.find(res, "502", 1, true) then
					warn("Unable to load data because Studio access to API services is disabled.")
					return;
				end
			end

			return ran and store
		end;

		DataStoreEncode = function(key)
			if Core.DS_RESET_SALTS[key] then
				key = Core.DS_RESET_SALTS[key] .. key
			end

			return Functions.Base64Encode(Remote.Encrypt(tostring(key), Settings.DataStoreKey))
		end;

		SaveData = function(...)
			return Core.SetData(...)
		end;

		DS_GetRequestDelay = function(reqTypeName: string)
			local reqType = assert(
				if reqTypeName == "Write" then Enum.DataStoreRequestType.SetIncrementAsync
					elseif reqTypeName == "Read" then Enum.DataStoreRequestType.GetAsync
					elseif reqTypeName == "Update" then Enum.DataStoreRequestType.UpdateAsync
					else nil,
				`Invalid request type name '{reqTypeName}'`
			)

			local reqPerMin = 60 + #service.Players:GetPlayers() * 10
			local reqDelay = 60 / reqPerMin

			local budget
			repeat
				budget = service.DataStoreService:GetRequestBudgetForRequestType(reqType);
			until budget > 0 and task.wait(1)

			return reqDelay + 0.5
		end;

		DS_WriteLimiter = function(reqTypeName: string, func, ...)
			local vararg = table.pack(...)
			return Queue(`DataStoreWriteData_{reqTypeName}`, function()
				local gotDelay = Core.DS_GetRequestDelay(reqTypeName); --// Wait for budget; also return how long we should wait before the next request is allowed to go
				func(unpack(vararg, 1, vararg.n))
				task.wait(gotDelay)
			end, 120, true)
		end;

		RemoveData = function(key)
			local DataStore = Core.DataStore
			if DataStore then
				local ran2, err2 = Queue(`DataStoreWriteData{key}`, function()
					local ran, ret = Core.DS_WriteLimiter("Write", DataStore.RemoveAsync, DataStore, Core.DataStoreEncode(key))
					if ran then
						Core.DataCache[key] = nil
					else
						logError(`DataStore RemoveAsync Failed: {ret}`)
					end
					task.wait(6)
				end, 120, true)

				if not ran2 then
					warn(`DataStore RemoveData Failed: {err2}`)
				end
			end
		end;

		SetData = function(key: string, value: any?, repeatCount: number?)
			if repeatCount then
				warn(`Retrying SetData request for {key}`);
			end

			local DataStore = Core.DataStore
			if DataStore then
				if value == nil then
					return Core.RemoveData(key)
				else
					local ran2, err2 = Queue(`DataStoreWriteData{key}`, function()
						local ran, ret = Core.DS_WriteLimiter("Write", DataStore.SetAsync, DataStore, Core.DataStoreEncode(key), value)
						if ran then
							Core.DataCache[key] = value
						else
							logError(`DataStore SetAsync Failed: {ret}`);
						end

						task.wait(6)
					end, 120, true)

					if not ran2 then
						logError(`DataStore SetData Failed: {err2}`)

						--// Attempt 3 times, with slight delay between if failed
						task.wait(1)
						if not repeatCount then
							return Core.SetData(key, value, 3);
						elseif repeatCount > 0 then
							return Core.SetData(key, value, repeatCount - 1);
						end
					end
				end
			end
		end;

		UpdateData = function(key: string, callback: (currentData: any?)->any?, repeatCount: number?)
			if repeatCount then
				warn(`Retrying UpdateData request for {key}`)
			end

			local DataStore = Core.DataStore
			if DataStore then
				local err = false
				local ran2, err2 = Queue(`DataStoreWriteData{key}`, function()
					local ran, ret = Core.DS_WriteLimiter("Update", DataStore.UpdateAsync, DataStore, Core.DataStoreEncode(key), callback)

					if not ran then
						err = ret
						logError(`DataStore UpdateAsync Failed: {ret}`)
						return error(ret)
					end

					task.wait(6)
				end, 120, true) --// 120 timeout, yield until this queued function runs and completes

				if not ran2 then
					logError(`DataStore UpdateData Failed: {err2}`)

					--// Attempt 3 times, with slight delay between if failed
					task.wait(1)
					if not repeatCount then
						return Core.UpdateData(key, callback, 3)
					elseif repeatCount > 0 then
						return Core.UpdateData(key, callback, repeatCount - 1)
					end
				end

				return err
			end
		end;

		GetData = function(key: string, repeatCount: number?)
			if repeatCount then
				warn(`Retrying GetData request for {key}`)
			end

			local DataStore = Core.DataStore
			if DataStore then
				local ran2, err2 = Queue("DataStoreReadData", function()
					--wait(Core.DS_GetRequestDelay("Read")) -- TODO: re-implement this effectively and without an unnecessary delay
					local ran, ret = pcall(DataStore.GetAsync, DataStore, Core.DataStoreEncode(key))
					if ran then
						Core.DataCache[key] = ret
						return ret
					else
						logError(`DataStore GetAsync Failed: {ret}`)
						if Core.DataCache[key] then
							return Core.DataCache[key]
						else
							error(ret)
						end
					end
				end, 120, true)

				if not ran2 then
					logError(`DataStore GetData Failed: {err2}`)
					--// Attempt 3 times, with slight delay between if failed
					task.wait(1)
					if not repeatCount then
						return Core.GetData(key, 3)
					elseif repeatCount > 0 then
						return Core.GetData(key, repeatCount - 1)
					end
				else
					return err2
				end
			end
		end;

		IndexPathToTable = function(tableAncestry)
			local ds_blacklist = Core.DS_BLACKLIST

			if type(tableAncestry) == "string" and not ds_blacklist[tableAncestry] then
				return Settings[tableAncestry], tableAncestry
			elseif type(tableAncestry) == "table" then
				local curTable = server
				local curName = "Server"

				for index, ind in tableAncestry do

					--// Prevent stuff like {t1 = "Settings", t2 = ...} from bypassing datastore blocks
					if type(index) ~= 'number' then
						return nil
					end

					curTable = curTable[ind]
					curName = ind

					if type(curName) == "string" then
						--// Admins do NOT load from the DataStore with this setting
						if curName == "Ranks" and Settings.LoadAdminsFromDS == false then
							return nil
						end
					end

					if not curTable then
						--warn(`{ind} could not be found`);
						--// Not allowed or table is not found
						return nil
					end
				end

				if type(curName) == "string" and ds_blacklist[curName] then
					return nil
				end

				return curTable, curName
			end
			return nil
		end;

		ClearAllData = function()
			local tabs = Core.GetData("SavedTables") or {}

			for _, v in tabs do
				if v.TableKey then
					Core.RemoveData(v.TableKey)
				end
			end

			Core.SetData("SavedSettings", {})
			Core.SetData("SavedTables", {})
			Core.CrossServer("LoadData")
		end;

		GetTableKey = function(indList: {string})
			local tabs = Core.GetData("SavedTables") or {}
			local realTable, tableName = Core.IndexPathToTable(indList)

			local foundTable = nil

			for _, v in tabs do
				if type(v) == "table" and v.TableName and v.TableName == tableName then
					foundTable = v
					break
				end
			end

			if not foundTable then
				foundTable = {
					TableName = tableName;
					TableKey = `SAVEDTABLE_{tableName}`;
				}

				table.insert(tabs, foundTable)
				Core.SetData("SavedTables", tabs)
			end

			if not Core.GetData(foundTable.TableKey) then
				Core.SetData(foundTable.TableKey, {})
			end

			return foundTable.TableKey;
		end;

		DoSave = function(data: TableData)
			if data.Type == "ClearSettings" then
				Core.ClearAllData()
			elseif data.Type == "SetSetting" then
				local setting = data.Setting
				local val = data.Value

				Core.UpdateData("SavedSettings", function(savedSettings)
					savedSettings[setting] = val
					return savedSettings
				end)

				Core.CrossServer("LoadData", "SavedSettings", {[setting] = val})
			elseif data.Type == "TableRemove" then
				local tab = data.Table
				local val = data.Value
				local key = Core.GetTableKey(tab)

				--// Storing an old reference of data.Table as we may override it later on.
				local originalTable = tab

				if type(tab) == "string" then
					tab = {"Settings", tab}
				elseif type(tab) == "table" and tab[1] == "Settings" then
					originalTable = tab[2]
				end

				data.Action = "Remove"
				data.Time = os.time()

				local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
				Core.UpdateData(key, function(sets)
					sets = sets or {}

					local index = 1
					for i, v in sets do
						if type(i) ~= "number" then
							sets[i] = nil
						elseif (CheckMatch(tab, v.Table) or CheckMatch(originalTable, v.Table)) and CheckMatch(v.Value, val) then
							table.remove(sets, index)
						else
							index += 1
						end
					end

					--// Check that the real table actually has the item to remove; do not create if it does not have it
					--// (prevents snowballing)
					local continueOperation = false
					if tab[1] == "Settings" or tab[2] == "Settings" then
						local indClone = table.clone(tab)
						indClone[1] = "OriginalSettings"
						for _, v in pairs(Core.IndexPathToTable(indClone) or {}) do
							if CheckMatch(v, val) then
								continueOperation = true
								break
							end
						end
					end

					return sets
				end)

				Core.CrossServer("LoadData", "TableUpdate", data)
			elseif data.Type == "TableAdd" then
				local tab = data.Table
				local originalTable = tab
				local val = data.Value
				local key = Core.GetTableKey(tab)

				if type(tab) == "string" then
					tab = {"Settings", tab}
				end

				data.Action = "Add"
				data.Time = os.time()

				local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
				Core.UpdateData(key, function(sets: {TableData})
					sets = sets or {}

					local index = 1
					for i, v in sets do
						if type(i) ~= "number" then
							sets[i] = nil
						elseif (CheckMatch(tab, v.Table) or CheckMatch(originalTable, v.Table)) and CheckMatch(v.Value, val) then
							table.remove(sets, index)
						else
							index += 1
						end
					end

					--// Check that the real table does not already have the item to add; do not create if it has it
					--// (prevents snowballing)
					local continueOperation = true
					if tab[1] == "Settings" or tab[2] == "Settings" then
						local indClone = table.clone(tab)
						indClone[1] = "OriginalSettings"
						for _, v in Core.IndexPathToTable(indClone) or {} do
							if CheckMatch(v, val) then
								continueOperation = false
								break
							end
						end
					end

					if continueOperation then
						table.insert(sets, data)
					end

					return sets
				end)

				Core.CrossServer("LoadData", "TableUpdate", data)
			else
				error(`Invalid data action type '{data.Type}'`, 2)
			end

			AddLog(Logs.Script, {
				Text = "Saved setting change to datastore";
				Desc = `A setting change was issued and saved ({data.Type})`;
			})
		end;

		LoadData = function(key: string, data: TableData, serverId: string?)
			if serverId and serverId == game.JobId then
				return
			end

			local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
			local ds_blacklist = Core.DS_BLACKLIST

			if key == "TableUpdate" then
				local indList = data.Table
				local nameRankComp = { --// Old settings backwards compatability
					Owners = { "Settings", "Ranks", "HeadAdmins", "Users" },
					Creators = { "Settings", "Ranks", "Creators", "Users" },
					HeadAdmins = { "Settings", "Ranks", "HeadAdmins", "Users" },
					Admins = { "Settings", "Ranks", "Admins", "Users" },
					Moderators = { "Settings", "Ranks", "Moderators", "Users" },
				}

				if type(indList) == "string" and nameRankComp[indList] then
					indList = nameRankComp[indList]
				end

				local realTable, tableName = Core.IndexPathToTable(indList)
				local displayName = type(indList) == "table" and table.concat(indList, ".") or tableName

				if type(displayName) == "string" then
					if ds_blacklist[displayName] then
						return
					end

					if type(indList) == "table" and indList[1] == "Settings" and indList[2] == "Ranks" then
						if
							not Settings.SaveAdmins
							and not Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff
							and not Settings.SaveAdminsWarning
							and Settings.LoadAdminsFromDS
						then
							warn(
								'Admins are loading from the Adonis DataStore when Settings.SaveAdmins is FALSE!\nDisable this warning by adding the setting "SaveAdminsWarning" in Settings (and set it to true!) or set Settings.LoadAdminsFromDS to false'
							)
							Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff = true
						end
						--// No adding to Trello or WebPanel rank users list via Datastore
						if type(indList[3]) == 'string' and (indList[3]:match("Trello") or indList[3]:match("WebPanel")) then
							return
						end
					end
				end

				if realTable and data.Action == "Add" then
					for i, v in realTable do
						if CheckMatch(v, data.Value) then
							table.remove(realTable, i)
						end
					end

					AddLog("Script", {
						Text = `Added value to {displayName}`,
						Desc = `Added {data.Value} to {displayName} from datastore`,
					})

					table.insert(realTable, data.Value)
					service.Events[`DataStoreAdd_{displayName}`]:Fire(data.Value)
				elseif realTable and data.Action == "Remove" then
					for i, v in realTable do
						if CheckMatch(v, data.Value) then
							AddLog("Script", {
								Text = `Removed value from {displayName}`,
								Desc = `Removed {data.Value} from {displayName} from datastore`,
							})

							table.remove(realTable, i)
						end
					end
				end
			else
				local SavedSettings
				local SavedTables

				if Core.DataStore and Settings.DataStoreEnabled then

					local GetData, LoadData, SaveData, DoSave = Core.GetData, Core.LoadData, Core.SaveData, Core.DoSave
					if not key then
						SavedSettings = GetData("SavedSettings")
						SavedTables = GetData("SavedTables")
					elseif key and not data then
						if key == "SavedSettings" then
							SavedSettings = GetData("SavedSettings")
						elseif key == "SavedTables" then
							SavedTables = GetData("SavedTables")
						end
					elseif key and data then
						if key == "SavedSettings" then
							SavedSettings = data
						elseif key == "SavedTables" then
							SavedTables = data
						end
					end

					if not key and not data then
						if not SavedSettings then
							SavedSettings = {}
							SaveData("SavedSettings", {})
						end

						if not SavedTables then
							SavedTables = {}
							SaveData("SavedTables", {})
						end
					end

					if SavedSettings then
						for setting, value in SavedSettings do
							if not ds_blacklist[setting] then

								if setting == "Prefix" or setting == "AnyPrefix" or setting == "SpecialPrefix" then
									local orig = Settings[setting]
									for _, cmd in server.Commands do
										if cmd.Prefix == orig then
											cmd.Prefix = value
										end
									end
								end

								Settings[setting] = value
							end
						end
					end

					if SavedTables then
						for _, tData in SavedTables do
							if tData.TableName and tData.TableKey and not ds_blacklist[tData.TableName] then
								local data = GetData(tData.TableKey)
								if data then
									for _, v in data do
										LoadData("TableUpdate", v)
									end
								end
							elseif tData.Table and tData.Action then
								LoadData("TableUpdate", tData)
							end
						end

						if Core.Variables.TimeBans then
							for i, v in Core.Variables.TimeBans do
								if v.EndTime - os.time() <= 0 then
									table.remove(Core.Variables.TimeBans, i)
									DoSave({
										Type = "TableRemove",
										Table = { "Core", "Variables", "TimeBans" },
										Value = v,
										LaxCheck = true,
									})
								end
							end
						end
					end

					AddLog(Logs.Script, {
						Text = "Loaded saved data",
						Desc = "Data was retrieved from the datastore and loaded successfully",
					})
				end
			end
		end,

		StartAPI = function()
			local _G = _G
			local setmetatable = setmetatable
			local rawset = rawset
			local rawget = rawget
			local type = type
			local error = error
			local print = print
			local warn = warn
			local pairs = pairs
			local next = next
			local table = table
			local getfenv = getfenv
			local setfenv = setfenv
			local require = require
			local tostring = tostring
			local server = server
			local service = service
			local Routine = env.Routine
			local cPcall = env.cPcall
			local MetaFunc = service.MetaFunc
			local StartLoop = service.StartLoop
			local API_Special = {
				AddAdmin = Settings.Allowed_API_Calls.DataStore;
				RemoveAdmin = Settings.Allowed_API_Calls.DataStore;
				RunCommand = Settings.Allowed_API_Calls.Core;
				SaveTableAdd = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
				SaveTableRemove = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
				SaveSetSetting = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
				ClearSavedSettings = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
				SetSetting = Settings.Allowed_API_Calls.Settings;
			}

			setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))

			local API_Specific = {
				API_Specific = {
					Test = function()
						print("We ran the api specific stuff")
					end
				};
				Settings = Settings;
				Service = service;
			}

			local API = {
				Access = MetaFunc(function(...)
					local args = {...}
					local key = args[1]
					local ind = args[2]
					local targ

					if API_Specific[ind] then
						targ = API_Specific[ind]
					elseif server[ind] and Settings.Allowed_API_Calls[ind] then
						targ = server[ind]
					end

					if Settings.G_Access and key == Settings.G_Access_Key and targ and Settings.Allowed_API_Calls[ind] == true then
						if type(targ) == "table" then
							return service.NewProxy {
								__index = function(tab,inde)
									if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
										AddLog(Logs.Script, {
											Text = `Access to {inde} was granted`;
											Desc = `A server script was granted access to {inde}`;
										})

										if targ[inde]~=nil and type(targ[inde]) == "table" and Settings.G_Access_Perms == "Read" then
											return service.ReadOnly(targ[inde])
										else
											return targ[inde]
										end
									elseif API_Special[inde] == false then
										AddLog(Logs.Script, {
											Text = `Access to {inde} was denied`;
											Desc = `A server script attempted to access {inde} via _G.Adonis.Access`;
										})

										error(`Access Denied: {inde}`)
									else
										error(`Could not find {inde}`)
									end
								end;
								__newindex = function(tabl, inde, valu)
									if Settings.G_Access_Perms == "Read" then
										error("Read-only")
									elseif Settings.G_Access_Perms == "Write" then
										tabl[inde] = valu
									end
								end;
								__metatable = true;
							}
						end
					else
						error("Incorrect key or G_Access is disabled")
					end
				end);

				Scripts = service.ReadOnly({
					ExecutePermission = MetaFunc(function(srcScript, code)
						local exists;

						for _, v in Core.ScriptCache do
							if v.Script == srcScript then
								exists = v
							end
						end

						if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
							exists.Executions += 1
							return exists.Source, exists.Loadstring
						end

						local data = Core.ExecutePermission(srcScript, code)
						if data and data.Source then
							local module;
							if not exists then
								module = require(server.Shared.FiOne:Clone())
								table.insert(Core.ScriptCache, {
									Script = srcScript;
									Source = data.Source;
									Loadstring = module;
									noCache = data.noCache;
									runLimit = data.runLimit;
									Executions = data.Executions;
								})
							else
								module = exists.Loadstring
								exists.Source = data.Source
							end
							return data.Source, module
						end
					end);
				}, nil, nil, true);

				CheckAdmin = MetaFunc(Admin.CheckAdmin);

				IsAdmin = MetaFunc(Admin.CheckAdmin);

				IsBanned = MetaFunc(Admin.CheckBan);

				IsMuted = MetaFunc(Admin.IsMuted);

				CheckDonor = MetaFunc(Admin.CheckDonor);

				GetLevel = MetaFunc(Admin.GetLevel);

				SetLighting = MetaFunc(Functions.SetLighting);

				SetPlayerLighting = MetaFunc(Remote.SetLighting);

				NewParticle = MetaFunc(Functions.NewParticle);

				RemoveParticle = MetaFunc(Functions.RemoveParticle);

				NewLocal = MetaFunc(Remote.NewLocal);

				MakeLocal = MetaFunc(Remote.MakeLocal);

				MoveLocal = MetaFunc(Remote.MoveLocal);

				RemoveLocal = MetaFunc(Remote.RemoveLocal);

				Hint = MetaFunc(Functions.Hint);

				Message = MetaFunc(Functions.Message);

				RunCommandAsNonAdmin = MetaFunc(Admin.RunCommandAsNonAdmin);
			}

			local AdonisGTable = service.NewProxy({
				__index = function(tab,ind)
					if Settings.G_API then
						return API[ind]
					elseif ind == "Scripts" then
						return API.Scripts
					else
						error("_G API is disabled")
					end
				end;
				__newindex = function()
					error("Read-only")
				end;
				__metatable = true;
			})

			if not rawget(_G, "Adonis") then
				if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
					rawset(_G, "Adonis", AdonisGTable)
					StartLoop("APICheck", 1, function()
						if rawget(_G, "Adonis") ~= AdonisGTable then
							if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
								rawset(_G, "Adonis", AdonisGTable)
							else
								warn("⚠ ADONIS CRITICAL WARNING! MALICIOUS CODE IS TRYING TO CHANGE THE ADONIS _G API AND IT CAN'T BE SET BACK! PLEASE SHUTDOWN THE SERVER AND REMOVE THE MALICIOUS CODE IF POSSIBLE!")
							end
						end
					end, true)
				else
					warn("The _G table was locked and the Adonis _G API could not be loaded")
				end
			end

			AddLog(Logs.Script, {
				Text = "Started _G API";
				Desc = "The Adonis _G API was initialized and is ready to use";
			})
		end;
	};
end


Prompt:
--- Cleans up the Tasks assigned to the Maid
-- This Disconnects RBXScriptConnections, Destroys Instances, and calls Functions/callable Tables

Response:
function Maid:DoCleaning()
	local Tasks = self._Tasks
	for Name, Task in next, Tasks do
		local Type = typeof(Task)
		local IsTable = Type == "table"
		if Type == "RBXScriptConnection" or IsTable and Task.Disconnect then
			Task:Disconnect()
		elseif Type == "Instance" or IsTable and Task.Destroy then
			Task:Destroy()
		else
			Task()
		end
		Tasks[Name] = nil
	end
end
Maid.Disconnect = Maid.DoCleaning
Maid.Destroy = Maid.DoCleaning


Prompt:
--[[
	Connect to the datastore, set up connections and create resources used by
	the server

	Parameters:
	configValues: A table containing configuration values
]]

Response:
local function setup(configValues)
	local tokenDataStore = DataStoreService:GetDataStore(configValues.datastoreName)
	tokenManager = TokenManager.new(tokenDataStore)
	local tokens = CollectionService:GetTagged(configValues.tokenTag)
	local resetOnPlayerRemoving = configValues.resetOnPlayerRemoving

	tokenManager:setTokens(tokens)

	connections[1] = CollectionService
		:GetInstanceAddedSignal(configValues.tokenTag)
		:Connect(onTokenAdded(remoteEvents, tokenManager))
	connections[2] = CollectionService
		:GetInstanceRemovedSignal(configValues.tokenTag)
		:Connect(onTokenRemoved(remoteEvents, tokenManager))
	connections[3] = Players.PlayerAdded:Connect(onPlayerAdded(remoteEvents, tokenDataStore, tokenManager))
	connections[4] = Players.PlayerRemoving:Connect(
		onPlayerRemoved(tokenDataStore, tokenManager, resetOnPlayerRemoving)
	)
	connections[5] = events.disable.Event:Connect(onHuntDisabled(tokenManager))
	connections[6] = events.enable.Event:Connect(onHuntEnabled(tokenManager))
end

config.changed:Connect(function(configValues)
	-- Clean up old data if it exists
	disconnectOldConnections()
	if tokenManager then
		tokenManager:cleanupTokens()
	end

	setup(configValues)
end)

setup(config.getValues())


Prompt:
--[[
	A 'Symbol' is an opaque marker type, implemented to behave similarly to JS:
	https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
]]

Response:
local Symbol = require(script.Symbol)
export type Symbol = Symbol.Symbol
local GlobalRegistry = require(script.GlobalRegistry)

local SymbolObject = setmetatable({}, {
	--[[
		Creates a new symbol, using the given name when printed. Symbols are
		opaque, so this will always create a new, unique object
	]]
	__call = function(_, name: string?): Symbol.Symbol
		return Symbol.new(name)
	end,
})

SymbolObject.for_ = GlobalRegistry.getOrInit

return SymbolObject


Prompt: --!strict

Response:
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local constants = {
	-- The location where all DevModules are moved at runtime. Note that a DevModule
	-- is moved after its scripts and other instances have been moved to their
	-- proper locations. What remains of the DevModule is the Packages folder, and
	-- any ModuleScripts that are used by the DevModule.
	DEV_MODULE_STORAGE = ReplicatedStorage,

	-- DevModules rely on dependencies. By convention, these are stored in a folder
	-- named "Packages" inside the root of the DevModule. At runtime, the Packages
	-- folders from every DevModule are deduplicated, resulting in only one version
	-- of each package in use across all the DevModules in the game
	PACKAGE_NAME = "Packages",
	PACKAGE_STORAGE_LOCATION = ReplicatedStorage,
	PACKAGE_STORAGE_NAME = "DevModulePackages",
	PACKAGE_REF = script.Parent.packageRef,

	-- The version of a package is controlled by a StringValue included as a child
	-- of the package. This constant controls the name of that StringValue.
	--
	-- Initially we wanted to use Attributes for the version, however Rojo does not
	-- support syncing Attributes yet. As such, we've opted to go the old fashioned
	-- way of including a StringValue.
	PACKAGE_VERSION_NAME = "_Version",

	PACKAGE_VERSION_OBJECT_MISSING = "%s is missing a %s StringValue at %s",
	PACKAGE_VERSION_EMPTY = "%s cannot have an empty value for its version at %s",
	ENABLED_SCRIPTS_ERROR = "All scripts included with a DevModule must be Disabled. Please disable the "
		.. "following script(s): %s",
}

return constants


Prompt: -- Also returns nil for speedyness

Response:
function DataStoreStage:_promiseInvokeSavingCallbacks()
	if not next(self._savingCallbacks) then
		return nil
	end

	local removingPromises = {}
	for _, func in pairs(self._savingCallbacks) do
		local result = func()
		if Promise.isPromise(result) then
			table.insert(removingPromises, result)
		end
	end

	for _, substore in pairs(self._stores) do
		local promise = substore:_promiseInvokeSavingCallbacks()
		if promise then
			table.insert(removingPromises, promise)
		end
	end

	return PromiseUtils.all(removingPromises)
end


Prompt:
--[[
	Calls awaitStatus internally, returns (isResolved, values...)
]]

Response:
function Promise.prototype:await()
	return awaitHelper(self:awaitStatus())
end
Promise.prototype.Await = Promise.prototype.await

local function expectHelper(status, ...)
	if status ~= Promise.Status.Resolved then
		error((...) == nil and "Expected Promise rejected with no value." or (...), 3)
	end

	return ...
end


Prompt: --Made by Luckymaxer

Response:
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
UserInputService = game:GetService("UserInputService")

AmmoDisplay = script:WaitForChild("AmmoDisplay"):Clone()
CastLaser = Tool:WaitForChild("CastLaser"):Clone()

Camera = game:GetService("Workspace").CurrentCamera

BaseUrl = "http://www.roblox.com/asset/?id="

AnimationTracks = {}
LocalObjects = {}

Animations = {
	Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 2},
	Fire = {Animation = Tool:WaitForChild("Fire"), FadeTime = 0.25, Weight = nil, Speed = 0.5, Duration = 0.5},
	Reload = {Animation = Tool:WaitForChild("Reload"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 2},
}

Sounds = {
	Reload = Handle:WaitForChild("Reload"),
	NoAmmo = Handle:WaitForChild("NoAmmo"),
}

Modules = Tool:WaitForChild("Modules")
Functions = require(Modules:WaitForChild("Functions"))

Remotes = Tool:WaitForChild("Remotes")
ServerControl = Remotes:WaitForChild("ServerControl")
ClientControl = Remotes:WaitForChild("ClientControl")

ConfigurationBin = Tool:WaitForChild("Configuration")
Configuration = {}
Configuration = Functions.CreateConfiguration(ConfigurationBin, Configuration)

InputCheck = Instance.new("ScreenGui")
InputCheck.Name = "InputCheck"
InputButton = Instance.new("ImageButton")
InputButton.Name = "InputButton"
InputButton.Image = ""
InputButton.BackgroundTransparency = 1
InputButton.ImageTransparency = 1
InputButton.Size = UDim2.new(1, 0, 1, 0)
InputButton.Parent = InputCheck

Cursors = {
	Normal = (BaseUrl .. "170908665"),
	EnemyHit = (BaseUrl .. "172618259"),
}

Rate = (1 / 60)

FiringOffset = Vector3.new(0, ((Handle.Size.Y / 4) - 0.2), -(Handle.Size.Z / 2))

Reloading = false
MouseDown = false
ToolEquipped = false

Tool.Enabled = true

function SetAnimation(mode, value)
	if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
		for i, v in pairs(AnimationTracks) do
			if v.Animation == value.Animation then
				v.AnimationTrack:Stop()
				table.remove(AnimationTracks, i)
			end
		end
		local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
		table.insert(AnimationTracks, {Animation = value.Animation, AnimationTrack = AnimationTrack})
		AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
	elseif mode == "StopAnimation" and value then
		for i, v in pairs(AnimationTracks) do
			if v.Animation == value.Animation then
				v.AnimationTrack:Stop(value.FadeTime)
				table.remove(AnimationTracks, i)
			end
		end
	end
end

function ToggleGui()
	if not AmmoDisplayClone or not AmmoDisplayClone.Parent then
		return
	end
	local Frame = AmmoDisplayClone.Frame
	local Ammo = Frame.Ammo
	if Configuration.Ammo.ClipSize.MaxValue > 0 then
		Ammo.AmmoCounter.CounterPart.Text = Configuration.Ammo.ClipSize.Value
	end
	Ammo.MagCounter.CounterPart.Text = Configuration.Ammo.Magazines.Value
end

function Reload()
	if Reloading or not Tool.Enabled or Configuration.Ammo.Magazines.Value >= Configuration.Ammo.Magazines.MaxValue then
		return
	end
	Tool.Enabled = false
	Reloading = true
	ToggleGui()
	local CanReload = true
	if Configuration.Ammo.ClipSize.MaxValue > 0 and Configuration.Ammo.ClipSize.Value <= 0 then
		CanReload = false
	else
		CanReload = true
	end
	if CanReload then
		Spawn(function()
			local Animation = Animations.Reload
			OnClientInvoke("PlayAnimation", Animation)
			wait(Animation.Duration)
			OnClientInvoke("StopAnimation", Animation)
		end)
		Sounds.Reload:Play()
		script.Parent.rld:FireServer()
		local AddedClips = ((Configuration.Ammo.Magazines.MaxValue > 0 and (Configuration.Ammo.Magazines.MaxValue - Configuration.Ammo.Magazines.Value)) or Configuration.Ammo.ClipSize.MaxValue)
		if Configuration.Ammo.ClipSize.MaxValue > 0 then
			AddedClips = ((AddedClips > Configuration.Ammo.ClipSize.Value and Configuration.Ammo.ClipSize.Value) or AddedClips)
		end
		--[[local ReloadRate = (Configuration.ReloadTime.Value / Configuration.Ammo.Magazines.MaxValue)
		for i = 1, AddedClips do
			wait(ReloadTime)
			Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value + 1)
		end]]
		wait(Configuration.ReloadTime.Value)
		Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value + AddedClips)
		Configuration.Ammo.ClipSize.Value = (Configuration.Ammo.ClipSize.Value - AddedClips)
		Sounds.Reload:Stop()
		ToggleGui()
	end
	Reloading = false
	Tool.Enabled = true
end

function RayTouched(Hit, Position)
	if not Hit or not Hit.Parent then
		return
	end
	local character = Hit.Parent
	if character:IsA("Hat") then
		character = character.Parent
	end
	if character == Character then
		return
	end
	local humanoid = character:FindFirstChild("Humanoid")
	local SoundChosen = Sounds.RayHit
	if not humanoid or humanoid.Health == 0 then
		return
	end
	local player = Players:GetPlayerFromCharacter(character)
	if player and Functions.IsTeamMate(Player, player) then
		return
	end
	Spawn(function()
		IconChangeTick = tick()
		PlayerMouse.Icon = Cursors.EnemyHit
		wait(1)
		if (tick() - IconChangeTick) >= 0.95 and ToolEquipped and PlayerMouse then
			PlayerMouse.Icon = Cursors.Normal
		end
	end)
end

function FireRay(StartPosition, TargetPosition)
	local Direction = CFrame.new(StartPosition, TargetPosition).lookVector
	local RayHit, RayPos, RayNormal = Functions.CastRay(StartPosition, Direction, Configuration.Range.Value, {Character}, false)
	local Backpack = Player:FindFirstChild("Backpack")
	if Backpack then
		local LaserScript = CastLaser:Clone()
		local StartPos = Instance.new("Vector3Value")
		StartPos.Name = "StartPosition"
		StartPos.Value = StartPosition
		StartPos.Parent = LaserScript
		local TargetPos = Instance.new("Vector3Value")
		TargetPos.Name = "TargetPosition"
		TargetPos.Value = RayPos
		TargetPos.Parent = LaserScript
		local RayHit = Instance.new("BoolValue")
		RayHit.Name = "RayHit"
		RayHit.Value = RayHit
		RayHit.Parent = LaserScript
		LaserScript.Disabled = false
		LaserScript.Parent = Backpack
	end
	Spawn(function()
		InvokeServer("CastLaser", {StartPosition = StartPosition, TargetPosition = RayPos, RayHit = ((RayHit and true) or false)})
	end)
	Spawn(function()
		InvokeServer("RayHit", {Hit = RayHit, Position = RayPos})
	end)
	RayTouched(RayHit, RayPos)
end

function Button1Pressed(Down)
	if not Down and MouseDown then
		MouseDown = false
	end
end

function KeyPress(Key, Down)
	if Key == "r" and Down then
		Reload()
	end
end

function Activated()
	if not Tool.Enabled or not ToolEquipped or Reloading then
		return
	end
	Tool.Enabled = false
	if Configuration.Ammo.Magazines.Value > 0 then
		local FirstShot = false
		if Configuration.Automatic.Value then
			MouseDown = true
		end
		OnClientInvoke("StopAnimation", {Animation = Animations.Fire.Animation, FadeTime = nil})
		OnClientInvoke("PlayAnimation", Animations.Fire)
		while MouseDown or not FirstShot and ToolEquipped and CheckIfAlive() do
			if Configuration.Ammo.Magazines.Value <= 0 or not ToolEquipped or not CheckIfAlive() then
				break
			end
			if not FirstShot then
				FirstShot = true
			end
			local BurstAmount = math.random(Configuration.Burst.Bullets.MinValue, Configuration.Burst.Bullets.MaxValue)
			local WithinFiringRange = false
			Spawn(function()
				InvokeServer("Fire", true)
			end)
			for i = 1, ((BurstAmount > 0 and BurstAmount) or 1) do
				local TargetPosition = OnClientInvoke("MousePosition")
				if not TargetPosition then
					break
				end
				TargetPosition = TargetPosition.Position
				local StartPosition = (Handle.CFrame * CFrame.new(FiringOffset.X, FiringOffset.Y, FiringOffset.Z)).p
				if BurstAmount > 0 then
					local Offset = (Configuration.Burst.Offset.Value * 100)
					TargetPosition = TargetPosition + Vector3.new((math.random(-Offset.X, Offset.X) * 0.01), (math.random(-Offset.Y, Offset.Y) * 0.01), (math.random(-Offset.Z, Offset.Z) * 0.01))
				end
				local Accuracy = (Configuration.Accuracy.Value * 100)
				TargetPosition = TargetPosition + Vector3.new((math.random(-Accuracy.X, Accuracy.X) * 0.01), (math.random(-Accuracy.Y, Accuracy.Y) * 0.01), (math.random(-Accuracy.Z, Accuracy.Z) * 0.01))
				Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value - 1)
				FireRay(StartPosition, TargetPosition)
			end
			ToggleGui()
			wait(Configuration.FireRate.Value)
		end
		OnClientInvoke("StopAnimation", {Animation = Animations.Fire.Animation, FadeTime = 0.25})
	else
		Tool.Enabled = true
		Sounds.NoAmmo:Play()
		Reload()
	end
	MouseDown = false
	Tool.Enabled = true
	if Configuration.Ammo.Magazines.Value <= 0 then
		Sounds.NoAmmo:Play()
		Reload()
	end
end

function CheckIfAlive()
	return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	if not CheckIfAlive() then
		return
	end
	ToolEquipped = true
	Spawn(function()
		PlayerMouse = Player:GetMouse()
		Mouse.Button1Down:connect(function()
			Button1Pressed(true)
		end)
		Mouse.Button1Up:connect(function()
			Button1Pressed(false)
		end)
		Mouse.KeyDown:connect(function(Key)
			KeyPress(Key, true)
		end)
		Mouse.KeyUp:connect(function(Key)
			KeyPress(Key, false)
		end)
		Humanoid.CameraOffset = Vector3.new(0, 0.35, 0)
		OnClientInvoke("PlayAnimation", Animations.Hold)
		local PlayerGui = Player:FindFirstChild("PlayerGui")
		if PlayerGui then
			if UserInputService.TouchEnabled then
				InputCheckClone = InputCheck:Clone()
				InputCheckClone.InputButton.InputBegan:connect(function()
					InvokeServer("Button1Click", {Down = true})
				end)
				InputCheckClone.InputButton.InputEnded:connect(function()
					InvokeServer("Button1Click", {Down = false})
				end)
				InputCheckClone.Parent = PlayerGui
			end
			local function AdjustAmmoDisplay()
				local Frame = AmmoDisplayClone.Frame
				Frame.CurrentWeapon.Text = script.Parent.Name
				local Ammo = Frame.Ammo
				Ammo.AmmoCounter.CounterPart.Text = ((Configuration.Ammo.ClipSize.MaxValue > 0 and Configuration.Ammo.ClipSize.Value) or "--")
				Ammo.MagCounter.CounterPart.Text = Configuration.Ammo.Magazines.Value
			end
			AmmoDisplayClone = AmmoDisplay:Clone()
			AdjustAmmoDisplay()
			AmmoDisplayClone.Parent = PlayerGui
			ToggleGui()
			for i, v in pairs({ClipSizeChanged, MagazinesChanged}) do
				if v then
					v:disconnect()
				end
			end
			ClipSizeChanged = Configuration.Ammo.ClipSize.Changed:connect(function()
				AdjustAmmoDisplay()
			end)
			MagazinesChanged = Configuration.Ammo.Magazines.Changed:connect(function()
				AdjustAmmoDisplay()
			end)
		end
		for i, v in pairs({"Left Arm", "Right Arm"}) do
			local Arm = Character:FindFirstChild(v)
			if Arm then
				Spawn(function()
					OnClientInvoke("SetLocalTransparencyModifier", {Object = Arm, Transparency = 0, AutoUpdate = false})
				end)
			end
		end
		Mouse.Icon = Cursors.Normal
	end)
end

function Unequipped()
	LocalObjects = {}
	if CheckIfAlive() then
		Humanoid.CameraOffset = Vector3.new(0, 0, 0)
	end
	for i, v in pairs(Sounds) do
		v:Stop()
	end
	if PlayerMouse then
		PlayerMouse.Icon = ""
	end
	for i, v in pairs({InputCheckClone, ObjectLocalTransparencyModifier, AmmoDisplayClone, ClipSizeChanged, MagazinesChanged}) do
		if tostring(v) == "Connection" then
			v:disconnect()
		elseif v and v.Parent then
			v:Destroy()
		end
	end
	MouseDown = false
	for i, v in pairs(AnimationTracks) do
		if v and v.AnimationTrack then
			v.AnimationTrack:Stop()
		end
	end
	AnimationTracks = {}
	ToolEquipped = false
end

function InvokeServer(mode, value)
	pcall(function()
		local ServerReturn = ServerControl:InvokeServer(mode, value)
		return ServerReturn
	end)
end

function OnClientInvoke(mode, value)
	if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
		SetAnimation("PlayAnimation", value)
	elseif mode == "StopAnimation" and value then
		SetAnimation("StopAnimation", value)
	elseif mode == "PlaySound" and value then
		value:Play()
	elseif mode == "StopSound" and value then
		value:Stop()
	elseif mode == "MousePosition" then
		return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
	elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
		pcall(function()
			local ObjectFound = false
			for i, v in pairs(LocalObjects) do
				if v == value then
					ObjectFound = true
				end
			end
			if not ObjectFound then
				table.insert(LocalObjects, value)
				if ObjectLocalTransparencyModifier then
					ObjectLocalTransparencyModifier:disconnect()
				end
				ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
					for i, v in pairs(LocalObjects) do
						if v.Object and v.Object.Parent then
							local CurrentTransparency = v.Object.LocalTransparencyModifier
							if ((not v.AutoUpdate and (CurrentTransparency == 1 or  CurrentTransparency == 0)) or v.AutoUpdate) then
								v.Object.LocalTransparencyModifier = v.Transparency
							end
						else
							table.remove(LocalObjects, i)
						end
					end
				end)
			end
		end)
	end
end

ClientControl.OnClientInvoke = OnClientInvoke

Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)


Prompt: --//Services//--

Response:
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")


Prompt:
-- Note: DotProduct check in CoordinateFrame::lookAt() prevents using values within about
-- 8.11 degrees of the +/- Y axis, that's why these limits are currently 80 degrees

Response:
local MIN_Y = math.rad(0)
local MAX_Y = math.rad(0)

local VR_ANGLE = math.rad(15)
local VR_LOW_INTENSITY_ROTATION = Vector2.new(math.rad(15), 0)
local VR_HIGH_INTENSITY_ROTATION = Vector2.new(math.rad(45), 0)
local VR_LOW_INTENSITY_REPEAT = 0.1
local VR_HIGH_INTENSITY_REPEAT = 0.4

local ZERO_VECTOR2 = Vector2.new(0,0)
local ZERO_VECTOR3 = Vector3.new(0,0,0)

local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0,4,0)
local HEAD_OFFSET = Vector3.new(0,1.5,0)
local R15_HEAD_OFFSET = Vector3.new(0, 1.5, 0)
local R15_HEAD_OFFSET_NO_SCALING = Vector3.new(0, 2, 0)
local HUMANOID_ROOT_PART_SIZE = Vector3.new(2, 2, 1)

local GAMEPAD_ZOOM_STEP_1 = 0
local GAMEPAD_ZOOM_STEP_2 = 10
local GAMEPAD_ZOOM_STEP_3 = 20

local ZOOM_SENSITIVITY_CURVATURE = 0.5
local FIRST_PERSON_DISTANCE_MIN = 0.5

local CameraUtils = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
local CameraToggleStateController = require(script.Parent:WaitForChild("CameraToggleStateController"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
local CameraUI = require(script.Parent:WaitForChild("CameraUI"))


Prompt: --//Controller//--

Response:
PlayerEvent.OnServerEvent:Connect(function(Player, X, Z)
	if not Chunks:FindFirstChild(X..", "..Z) then
		CreateNewChunk(X, Z)

	end
end)


Prompt: -- Implementation for Lua 5.1/5.2 (with or without bitwise library available)

Response:
local function sha256_feed_64(H, str, offs, size)
	-- offs >= 0, size >= 0, size is multiple of 64
	local W, K = common_W, sha2_K_hi
	local h1, h2, h3, h4, h5, h6, h7, h8 = H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8]
	for pos = offs, offs + size - 1, 64 do
		for j = 1, 16 do
			pos = pos + 4
			local a, b, c, d = string.byte(str, pos - 3, pos)
			W[j] = ((a * 256 + b) * 256 + c) * 256 + d
		end

		for j = 17, 64 do
			local a, b = W[j - 15], W[j - 2]
			W[j] = bit32_bxor(bit32_rrotate(a, 7), bit32_lrotate(a, 14), bit32_rshift(a, 3)) + bit32_bxor(bit32_lrotate(b, 15), bit32_lrotate(b, 13), bit32_rshift(b, 10)) + W[j - 7] + W[j - 16]
		end

		local a, b, c, d, e, f, g, h = h1, h2, h3, h4, h5, h6, h7, h8
		for j = 1, 64 do
			local z = bit32_bxor(bit32_rrotate(e, 6), bit32_rrotate(e, 11), bit32_lrotate(e, 7)) + bit32_band(e, f) + bit32_band(-1 - e, g) + h + K[j] + W[j]
			h = g
			g = f
			f = e
			e = z + d
			d = c
			c = b
			b = a
			a = z + bit32_band(d, c) + bit32_band(a, bit32_bxor(d, c)) + bit32_bxor(bit32_rrotate(a, 2), bit32_rrotate(a, 13), bit32_lrotate(a, 10))
		end

		h1, h2, h3, h4 = (a + h1) % 4294967296, (b + h2) % 4294967296, (c + h3) % 4294967296, (d + h4) % 4294967296
		h5, h6, h7, h8 = (e + h5) % 4294967296, (f + h6) % 4294967296, (g + h7) % 4294967296, (h + h8) % 4294967296
	end

	H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8] = h1, h2, h3, h4, h5, h6, h7, h8
end

local function sha512_feed_128(H_lo, H_hi, str, offs, size)
	-- offs >= 0, size >= 0, size is multiple of 128
	-- W1_hi, W1_lo, W2_hi, W2_lo, ...   Wk_hi = W[2*k-1], Wk_lo = W[2*k]
	local W, K_lo, K_hi = common_W, sha2_K_lo, sha2_K_hi
	local h1_lo, h2_lo, h3_lo, h4_lo, h5_lo, h6_lo, h7_lo, h8_lo = H_lo[1], H_lo[2], H_lo[3], H_lo[4], H_lo[5], H_lo[6], H_lo[7], H_lo[8]
	local h1_hi, h2_hi, h3_hi, h4_hi, h5_hi, h6_hi, h7_hi, h8_hi = H_hi[1], H_hi[2], H_hi[3], H_hi[4], H_hi[5], H_hi[6], H_hi[7], H_hi[8]
	for pos = offs, offs + size - 1, 128 do
		for j = 1, 16 * 2 do
			pos = pos + 4
			local a, b, c, d = string.byte(str, pos - 3, pos)
			W[j] = ((a * 256 + b) * 256 + c) * 256 + d
		end

		for jj = 34, 160, 2 do
			local a_lo, a_hi, b_lo, b_hi = W[jj - 30], W[jj - 31], W[jj - 4], W[jj - 5]
			local tmp1 = bit32_bxor(bit32_rshift(a_lo, 1) + bit32_lshift(a_hi, 31), bit32_rshift(a_lo, 8) + bit32_lshift(a_hi, 24), bit32_rshift(a_lo, 7) + bit32_lshift(a_hi, 25)) % 4294967296 +
				bit32_bxor(bit32_rshift(b_lo, 19) + bit32_lshift(b_hi, 13), bit32_lshift(b_lo, 3) + bit32_rshift(b_hi, 29), bit32_rshift(b_lo, 6) + bit32_lshift(b_hi, 26)) % 4294967296 +
				W[jj - 14] + W[jj - 32]

			local tmp2 = tmp1 % 4294967296
			W[jj - 1] = bit32_bxor(bit32_rshift(a_hi, 1) + bit32_lshift(a_lo, 31), bit32_rshift(a_hi, 8) + bit32_lshift(a_lo, 24), bit32_rshift(a_hi, 7)) +
				bit32_bxor(bit32_rshift(b_hi, 19) + bit32_lshift(b_lo, 13), bit32_lshift(b_hi, 3) + bit32_rshift(b_lo, 29), bit32_rshift(b_hi, 6)) +
				W[jj - 15] + W[jj - 33] + (tmp1 - tmp2) / 4294967296

			W[jj] = tmp2
		end

		local a_lo, b_lo, c_lo, d_lo, e_lo, f_lo, g_lo, h_lo = h1_lo, h2_lo, h3_lo, h4_lo, h5_lo, h6_lo, h7_lo, h8_lo
		local a_hi, b_hi, c_hi, d_hi, e_hi, f_hi, g_hi, h_hi = h1_hi, h2_hi, h3_hi, h4_hi, h5_hi, h6_hi, h7_hi, h8_hi
		for j = 1, 80 do
			local jj = 2 * j
			local tmp1 = bit32_bxor(bit32_rshift(e_lo, 14) + bit32_lshift(e_hi, 18), bit32_rshift(e_lo, 18) + bit32_lshift(e_hi, 14), bit32_lshift(e_lo, 23) + bit32_rshift(e_hi, 9)) % 4294967296 +
				(bit32_band(e_lo, f_lo) + bit32_band(-1 - e_lo, g_lo)) % 4294967296 +
				h_lo + K_lo[j] + W[jj]

			local z_lo = tmp1 % 4294967296
			local z_hi = bit32_bxor(bit32_rshift(e_hi, 14) + bit32_lshift(e_lo, 18), bit32_rshift(e_hi, 18) + bit32_lshift(e_lo, 14), bit32_lshift(e_hi, 23) + bit32_rshift(e_lo, 9)) +
				bit32_band(e_hi, f_hi) + bit32_band(-1 - e_hi, g_hi) +
				h_hi + K_hi[j] + W[jj - 1] +
				(tmp1 - z_lo) / 4294967296

			h_lo = g_lo
			h_hi = g_hi
			g_lo = f_lo
			g_hi = f_hi
			f_lo = e_lo
			f_hi = e_hi
			tmp1 = z_lo + d_lo
			e_lo = tmp1 % 4294967296
			e_hi = z_hi + d_hi + (tmp1 - e_lo) / 4294967296
			d_lo = c_lo
			d_hi = c_hi
			c_lo = b_lo
			c_hi = b_hi
			b_lo = a_lo
			b_hi = a_hi
			tmp1 = z_lo + (bit32_band(d_lo, c_lo) + bit32_band(b_lo, bit32_bxor(d_lo, c_lo))) % 4294967296 + bit32_bxor(bit32_rshift(b_lo, 28) + bit32_lshift(b_hi, 4), bit32_lshift(b_lo, 30) + bit32_rshift(b_hi, 2), bit32_lshift(b_lo, 25) + bit32_rshift(b_hi, 7)) % 4294967296
			a_lo = tmp1 % 4294967296
			a_hi = z_hi + (bit32_band(d_hi, c_hi) + bit32_band(b_hi, bit32_bxor(d_hi, c_hi))) + bit32_bxor(bit32_rshift(b_hi, 28) + bit32_lshift(b_lo, 4), bit32_lshift(b_hi, 30) + bit32_rshift(b_lo, 2), bit32_lshift(b_hi, 25) + bit32_rshift(b_lo, 7)) + (tmp1 - a_lo) / 4294967296
		end

		a_lo = h1_lo + a_lo
		h1_lo = a_lo % 4294967296
		h1_hi = (h1_hi + a_hi + (a_lo - h1_lo) / 4294967296) % 4294967296
		a_lo = h2_lo + b_lo
		h2_lo = a_lo % 4294967296
		h2_hi = (h2_hi + b_hi + (a_lo - h2_lo) / 4294967296) % 4294967296
		a_lo = h3_lo + c_lo
		h3_lo = a_lo % 4294967296
		h3_hi = (h3_hi + c_hi + (a_lo - h3_lo) / 4294967296) % 4294967296
		a_lo = h4_lo + d_lo
		h4_lo = a_lo % 4294967296
		h4_hi = (h4_hi + d_hi + (a_lo - h4_lo) / 4294967296) % 4294967296
		a_lo = h5_lo + e_lo
		h5_lo = a_lo % 4294967296
		h5_hi = (h5_hi + e_hi + (a_lo - h5_lo) / 4294967296) % 4294967296
		a_lo = h6_lo + f_lo
		h6_lo = a_lo % 4294967296
		h6_hi = (h6_hi + f_hi + (a_lo - h6_lo) / 4294967296) % 4294967296
		a_lo = h7_lo + g_lo
		h7_lo = a_lo % 4294967296
		h7_hi = (h7_hi + g_hi + (a_lo - h7_lo) / 4294967296) % 4294967296
		a_lo = h8_lo + h_lo
		h8_lo = a_lo % 4294967296
		h8_hi = (h8_hi + h_hi + (a_lo - h8_lo) / 4294967296) % 4294967296
	end

	H_lo[1], H_lo[2], H_lo[3], H_lo[4], H_lo[5], H_lo[6], H_lo[7], H_lo[8] = h1_lo, h2_lo, h3_lo, h4_lo, h5_lo, h6_lo, h7_lo, h8_lo
	H_hi[1], H_hi[2], H_hi[3], H_hi[4], H_hi[5], H_hi[6], H_hi[7], H_hi[8] = h1_hi, h2_hi, h3_hi, h4_hi, h5_hi, h6_hi, h7_hi, h8_hi
end

local function md5_feed_64(H, str, offs, size)
	-- offs >= 0, size >= 0, size is multiple of 64
	local W, K, md5_next_shift = common_W, md5_K, md5_next_shift
	local h1, h2, h3, h4 = H[1], H[2], H[3], H[4]
	for pos = offs, offs + size - 1, 64 do
		for j = 1, 16 do
			pos = pos + 4
			local a, b, c, d = string.byte(str, pos - 3, pos)
			W[j] = ((d * 256 + c) * 256 + b) * 256 + a
		end

		local a, b, c, d = h1, h2, h3, h4
		local s = 25
		for j = 1, 16 do
			local F = bit32_rrotate(bit32_band(b, c) + bit32_band(-1 - b, d) + a + K[j] + W[j], s) + b
			s = md5_next_shift[s]
			a = d
			d = c
			c = b
			b = F
		end

		s = 27
		for j = 17, 32 do
			local F = bit32_rrotate(bit32_band(d, b) + bit32_band(-1 - d, c) + a + K[j] + W[(5 * j - 4) % 16 + 1], s) + b
			s = md5_next_shift[s]
			a = d
			d = c
			c = b
			b = F
		end

		s = 28
		for j = 33, 48 do
			local F = bit32_rrotate(bit32_bxor(bit32_bxor(b, c), d) + a + K[j] + W[(3 * j + 2) % 16 + 1], s) + b
			s = md5_next_shift[s]
			a = d
			d = c
			c = b
			b = F
		end

		s = 26
		for j = 49, 64 do
			local F = bit32_rrotate(bit32_bxor(c, bit32_bor(b, -1 - d)) + a + K[j] + W[(j * 7 - 7) % 16 + 1], s) + b
			s = md5_next_shift[s]
			a = d
			d = c
			c = b
			b = F
		end

		h1 = (a + h1) % 4294967296
		h2 = (b + h2) % 4294967296
		h3 = (c + h3) % 4294967296
		h4 = (d + h4) % 4294967296
	end

	H[1], H[2], H[3], H[4] = h1, h2, h3, h4
end

local function sha1_feed_64(H, str, offs, size)
	-- offs >= 0, size >= 0, size is multiple of 64
	local W = common_W
	local h1, h2, h3, h4, h5 = H[1], H[2], H[3], H[4], H[5]
	for pos = offs, offs + size - 1, 64 do
		for j = 1, 16 do
			pos = pos + 4
			local a, b, c, d = string.byte(str, pos - 3, pos)
			W[j] = ((a * 256 + b) * 256 + c) * 256 + d
		end

		for j = 17, 80 do
			W[j] = bit32_lrotate(bit32_bxor(W[j - 3], W[j - 8], W[j - 14], W[j - 16]), 1)
		end

		local a, b, c, d, e = h1, h2, h3, h4, h5
		for j = 1, 20 do
			local z = bit32_lrotate(a, 5) + bit32_band(b, c) + bit32_band(-1 - b, d) + 0x5A827999 + W[j] + e -- constant = math.floor(TWO_POW_30 * sqrt(2))
			e = d
			d = c
			c = bit32_rrotate(b, 2)
			b = a
			a = z
		end

		for j = 21, 40 do
			local z = bit32_lrotate(a, 5) + bit32_bxor(b, c, d) + 0x6ED9EBA1 + W[j] + e -- TWO_POW_30 * sqrt(3)
			e = d
			d = c
			c = bit32_rrotate(b, 2)
			b = a
			a = z
		end

		for j = 41, 60 do
			local z = bit32_lrotate(a, 5) + bit32_band(d, c) + bit32_band(b, bit32_bxor(d, c)) + 0x8F1BBCDC + W[j] + e -- TWO_POW_30 * sqrt(5)
			e = d
			d = c
			c = bit32_rrotate(b, 2)
			b = a
			a = z
		end

		for j = 61, 80 do
			local z = bit32_lrotate(a, 5) + bit32_bxor(b, c, d) + 0xCA62C1D6 + W[j] + e -- TWO_POW_30 * sqrt(10)
			e = d
			d = c
			c = bit32_rrotate(b, 2)
			b = a
			a = z
		end

		h1 = (a + h1) % 4294967296
		h2 = (b + h2) % 4294967296
		h3 = (c + h3) % 4294967296
		h4 = (d + h4) % 4294967296
		h5 = (e + h5) % 4294967296
	end

	H[1], H[2], H[3], H[4], H[5] = h1, h2, h3, h4, h5
end

local function keccak_feed(lanes_lo, lanes_hi, str, offs, size, block_size_in_bytes)
	-- This is an example of a Lua function having 79 local variables :-)
	-- offs >= 0, size >= 0, size is multiple of block_size_in_bytes, block_size_in_bytes is positive multiple of 8
	local RC_lo, RC_hi = sha3_RC_lo, sha3_RC_hi
	local qwords_qty = block_size_in_bytes / 8
	for pos = offs, offs + size - 1, block_size_in_bytes do
		for j = 1, qwords_qty do
			local a, b, c, d = string.byte(str, pos + 1, pos + 4)
			lanes_lo[j] = bit32_bxor(lanes_lo[j], ((d * 256 + c) * 256 + b) * 256 + a)
			pos = pos + 8
			a, b, c, d = string.byte(str, pos - 3, pos)
			lanes_hi[j] = bit32_bxor(lanes_hi[j], ((d * 256 + c) * 256 + b) * 256 + a)
		end

		local L01_lo, L01_hi, L02_lo, L02_hi, L03_lo, L03_hi, L04_lo, L04_hi, L05_lo, L05_hi, L06_lo, L06_hi, L07_lo, L07_hi, L08_lo, L08_hi, L09_lo, L09_hi, L10_lo, L10_hi, L11_lo, L11_hi, L12_lo, L12_hi, L13_lo, L13_hi, L14_lo, L14_hi, L15_lo, L15_hi, L16_lo, L16_hi, L17_lo, L17_hi, L18_lo, L18_hi, L19_lo, L19_hi, L20_lo, L20_hi, L21_lo, L21_hi, L22_lo, L22_hi, L23_lo, L23_hi, L24_lo, L24_hi, L25_lo, L25_hi = lanes_lo[1], lanes_hi[1], lanes_lo[2], lanes_hi[2], lanes_lo[3], lanes_hi[3], lanes_lo[4], lanes_hi[4], lanes_lo[5], lanes_hi[5], lanes_lo[6], lanes_hi[6], lanes_lo[7], lanes_hi[7], lanes_lo[8], lanes_hi[8], lanes_lo[9], lanes_hi[9], lanes_lo[10], lanes_hi[10], lanes_lo[11], lanes_hi[11], lanes_lo[12], lanes_hi[12], lanes_lo[13], lanes_hi[13], lanes_lo[14], lanes_hi[14], lanes_lo[15], lanes_hi[15], lanes_lo[16], lanes_hi[16], lanes_lo[17], lanes_hi[17], lanes_lo[18], lanes_hi[18], lanes_lo[19], lanes_hi[19], lanes_lo[20], lanes_hi[20], lanes_lo[21], lanes_hi[21], lanes_lo[22], lanes_hi[22], lanes_lo[23], lanes_hi[23], lanes_lo[24], lanes_hi[24], lanes_lo[25], lanes_hi[25]

		for round_idx = 1, 24 do
			local C1_lo = bit32_bxor(L01_lo, L06_lo, L11_lo, L16_lo, L21_lo)
			local C1_hi = bit32_bxor(L01_hi, L06_hi, L11_hi, L16_hi, L21_hi)
			local C2_lo = bit32_bxor(L02_lo, L07_lo, L12_lo, L17_lo, L22_lo)
			local C2_hi = bit32_bxor(L02_hi, L07_hi, L12_hi, L17_hi, L22_hi)
			local C3_lo = bit32_bxor(L03_lo, L08_lo, L13_lo, L18_lo, L23_lo)
			local C3_hi = bit32_bxor(L03_hi, L08_hi, L13_hi, L18_hi, L23_hi)
			local C4_lo = bit32_bxor(L04_lo, L09_lo, L14_lo, L19_lo, L24_lo)
			local C4_hi = bit32_bxor(L04_hi, L09_hi, L14_hi, L19_hi, L24_hi)
			local C5_lo = bit32_bxor(L05_lo, L10_lo, L15_lo, L20_lo, L25_lo)
			local C5_hi = bit32_bxor(L05_hi, L10_hi, L15_hi, L20_hi, L25_hi)

			local D_lo = bit32_bxor(C1_lo, C3_lo * 2 + (C3_hi % TWO_POW_32 - C3_hi % TWO_POW_31) / TWO_POW_31)
			local D_hi = bit32_bxor(C1_hi, C3_hi * 2 + (C3_lo % TWO_POW_32 - C3_lo % TWO_POW_31) / TWO_POW_31)

			local T0_lo = bit32_bxor(D_lo, L02_lo)
			local T0_hi = bit32_bxor(D_hi, L02_hi)
			local T1_lo = bit32_bxor(D_lo, L07_lo)
			local T1_hi = bit32_bxor(D_hi, L07_hi)
			local T2_lo = bit32_bxor(D_lo, L12_lo)
			local T2_hi = bit32_bxor(D_hi, L12_hi)
			local T3_lo = bit32_bxor(D_lo, L17_lo)
			local T3_hi = bit32_bxor(D_hi, L17_hi)
			local T4_lo = bit32_bxor(D_lo, L22_lo)
			local T4_hi = bit32_bxor(D_hi, L22_hi)

			L02_lo = (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_20) / TWO_POW_20 + T1_hi * TWO_POW_12
			L02_hi = (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_20) / TWO_POW_20 + T1_lo * TWO_POW_12
			L07_lo = (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_19) / TWO_POW_19 + T3_hi * TWO_POW_13
			L07_hi = (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_19) / TWO_POW_19 + T3_lo * TWO_POW_13
			L12_lo = T0_lo * 2 + (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_31) / TWO_POW_31
			L12_hi = T0_hi * 2 + (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_31) / TWO_POW_31
			L17_lo = T2_lo * TWO_POW_10 + (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_22) / TWO_POW_22
			L17_hi = T2_hi * TWO_POW_10 + (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_22) / TWO_POW_22
			L22_lo = T4_lo * TWO_POW_2 + (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_30) / TWO_POW_30
			L22_hi = T4_hi * TWO_POW_2 + (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_30) / TWO_POW_30

			D_lo = bit32_bxor(C2_lo, C4_lo * 2 + (C4_hi % TWO_POW_32 - C4_hi % TWO_POW_31) / TWO_POW_31)
			D_hi = bit32_bxor(C2_hi, C4_hi * 2 + (C4_lo % TWO_POW_32 - C4_lo % TWO_POW_31) / TWO_POW_31)

			T0_lo = bit32_bxor(D_lo, L03_lo)
			T0_hi = bit32_bxor(D_hi, L03_hi)
			T1_lo = bit32_bxor(D_lo, L08_lo)
			T1_hi = bit32_bxor(D_hi, L08_hi)
			T2_lo = bit32_bxor(D_lo, L13_lo)
			T2_hi = bit32_bxor(D_hi, L13_hi)
			T3_lo = bit32_bxor(D_lo, L18_lo)
			T3_hi = bit32_bxor(D_hi, L18_hi)
			T4_lo = bit32_bxor(D_lo, L23_lo)
			T4_hi = bit32_bxor(D_hi, L23_hi)

			L03_lo = (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_21) / TWO_POW_21 + T2_hi * TWO_POW_11
			L03_hi = (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_21) / TWO_POW_21 + T2_lo * TWO_POW_11
			L08_lo = (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_3) / TWO_POW_3 + T4_hi * TWO_POW_29 % TWO_POW_32
			L08_hi = (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_3) / TWO_POW_3 + T4_lo * TWO_POW_29 % TWO_POW_32
			L13_lo = T1_lo * TWO_POW_6 + (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_26) / TWO_POW_26
			L13_hi = T1_hi * TWO_POW_6 + (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_26) / TWO_POW_26
			L18_lo = T3_lo * TWO_POW_15 + (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_17) / TWO_POW_17
			L18_hi = T3_hi * TWO_POW_15 + (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_17) / TWO_POW_17
			L23_lo = (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_2) / TWO_POW_2 + T0_hi * TWO_POW_30 % TWO_POW_32
			L23_hi = (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_2) / TWO_POW_2 + T0_lo * TWO_POW_30 % TWO_POW_32

			D_lo = bit32_bxor(C3_lo, C5_lo * 2 + (C5_hi % TWO_POW_32 - C5_hi % TWO_POW_31) / TWO_POW_31)
			D_hi = bit32_bxor(C3_hi, C5_hi * 2 + (C5_lo % TWO_POW_32 - C5_lo % TWO_POW_31) / TWO_POW_31)

			T0_lo = bit32_bxor(D_lo, L04_lo)
			T0_hi = bit32_bxor(D_hi, L04_hi)
			T1_lo = bit32_bxor(D_lo, L09_lo)
			T1_hi = bit32_bxor(D_hi, L09_hi)
			T2_lo = bit32_bxor(D_lo, L14_lo)
			T2_hi = bit32_bxor(D_hi, L14_hi)
			T3_lo = bit32_bxor(D_lo, L19_lo)
			T3_hi = bit32_bxor(D_hi, L19_hi)
			T4_lo = bit32_bxor(D_lo, L24_lo)
			T4_hi = bit32_bxor(D_hi, L24_hi)

			L04_lo = T3_lo * TWO_POW_21 % TWO_POW_32 + (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_11) / TWO_POW_11
			L04_hi = T3_hi * TWO_POW_21 % TWO_POW_32 + (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_11) / TWO_POW_11
			L09_lo = T0_lo * TWO_POW_28 % TWO_POW_32 + (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_4) / TWO_POW_4
			L09_hi = T0_hi * TWO_POW_28 % TWO_POW_32 + (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_4) / TWO_POW_4
			L14_lo = T2_lo * TWO_POW_25 % TWO_POW_32 + (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_7) / TWO_POW_7
			L14_hi = T2_hi * TWO_POW_25 % TWO_POW_32 + (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_7) / TWO_POW_7
			L19_lo = (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_8) / TWO_POW_8 + T4_hi * TWO_POW_24 % TWO_POW_32
			L19_hi = (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_8) / TWO_POW_8 + T4_lo * TWO_POW_24 % TWO_POW_32
			L24_lo = (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_9) / TWO_POW_9 + T1_hi * TWO_POW_23 % TWO_POW_32
			L24_hi = (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_9) / TWO_POW_9 + T1_lo * TWO_POW_23 % TWO_POW_32

			D_lo = bit32_bxor(C4_lo, C1_lo * 2 + (C1_hi % TWO_POW_32 - C1_hi % TWO_POW_31) / TWO_POW_31)
			D_hi = bit32_bxor(C4_hi, C1_hi * 2 + (C1_lo % TWO_POW_32 - C1_lo % TWO_POW_31) / TWO_POW_31)

			T0_lo = bit32_bxor(D_lo, L05_lo)
			T0_hi = bit32_bxor(D_hi, L05_hi)
			T1_lo = bit32_bxor(D_lo, L10_lo)
			T1_hi = bit32_bxor(D_hi, L10_hi)
			T2_lo = bit32_bxor(D_lo, L15_lo)
			T2_hi = bit32_bxor(D_hi, L15_hi)
			T3_lo = bit32_bxor(D_lo, L20_lo)
			T3_hi = bit32_bxor(D_hi, L20_hi)
			T4_lo = bit32_bxor(D_lo, L25_lo)
			T4_hi = bit32_bxor(D_hi, L25_hi)

			L05_lo = T4_lo * TWO_POW_14 + (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_18) / TWO_POW_18
			L05_hi = T4_hi * TWO_POW_14 + (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_18) / TWO_POW_18
			L10_lo = T1_lo * TWO_POW_20 % TWO_POW_32 + (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_12) / TWO_POW_12
			L10_hi = T1_hi * TWO_POW_20 % TWO_POW_32 + (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_12) / TWO_POW_12
			L15_lo = T3_lo * TWO_POW_8 + (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_24) / TWO_POW_24
			L15_hi = T3_hi * TWO_POW_8 + (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_24) / TWO_POW_24
			L20_lo = T0_lo * TWO_POW_27 % TWO_POW_32 + (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_5) / TWO_POW_5
			L20_hi = T0_hi * TWO_POW_27 % TWO_POW_32 + (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_5) / TWO_POW_5
			L25_lo = (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_25) / TWO_POW_25 + T2_hi * TWO_POW_7
			L25_hi = (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_25) / TWO_POW_25 + T2_lo * TWO_POW_7

			D_lo = bit32_bxor(C5_lo, C2_lo * 2 + (C2_hi % TWO_POW_32 - C2_hi % TWO_POW_31) / TWO_POW_31)
			D_hi = bit32_bxor(C5_hi, C2_hi * 2 + (C2_lo % TWO_POW_32 - C2_lo % TWO_POW_31) / TWO_POW_31)

			T1_lo = bit32_bxor(D_lo, L06_lo)
			T1_hi = bit32_bxor(D_hi, L06_hi)
			T2_lo = bit32_bxor(D_lo, L11_lo)
			T2_hi = bit32_bxor(D_hi, L11_hi)
			T3_lo = bit32_bxor(D_lo, L16_lo)
			T3_hi = bit32_bxor(D_hi, L16_hi)
			T4_lo = bit32_bxor(D_lo, L21_lo)
			T4_hi = bit32_bxor(D_hi, L21_hi)

			L06_lo = T2_lo * TWO_POW_3 + (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_29) / TWO_POW_29
			L06_hi = T2_hi * TWO_POW_3 + (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_29) / TWO_POW_29
			L11_lo = T4_lo * TWO_POW_18 + (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_14) / TWO_POW_14
			L11_hi = T4_hi * TWO_POW_18 + (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_14) / TWO_POW_14
			L16_lo = (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_28) / TWO_POW_28 + T1_hi * TWO_POW_4
			L16_hi = (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_28) / TWO_POW_28 + T1_lo * TWO_POW_4
			L21_lo = (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_23) / TWO_POW_23 + T3_hi * TWO_POW_9
			L21_hi = (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_23) / TWO_POW_23 + T3_lo * TWO_POW_9

			L01_lo = bit32_bxor(D_lo, L01_lo)
			L01_hi = bit32_bxor(D_hi, L01_hi)
			L01_lo, L02_lo, L03_lo, L04_lo, L05_lo = bit32_bxor(L01_lo, bit32_band(-1 - L02_lo, L03_lo)), bit32_bxor(L02_lo, bit32_band(-1 - L03_lo, L04_lo)), bit32_bxor(L03_lo, bit32_band(-1 - L04_lo, L05_lo)), bit32_bxor(L04_lo, bit32_band(-1 - L05_lo, L01_lo)), bit32_bxor(L05_lo, bit32_band(-1 - L01_lo, L02_lo))
			L01_hi, L02_hi, L03_hi, L04_hi, L05_hi = bit32_bxor(L01_hi, bit32_band(-1 - L02_hi, L03_hi)), bit32_bxor(L02_hi, bit32_band(-1 - L03_hi, L04_hi)), bit32_bxor(L03_hi, bit32_band(-1 - L04_hi, L05_hi)), bit32_bxor(L04_hi, bit32_band(-1 - L05_hi, L01_hi)), bit32_bxor(L05_hi, bit32_band(-1 - L01_hi, L02_hi))
			L06_lo, L07_lo, L08_lo, L09_lo, L10_lo = bit32_bxor(L09_lo, bit32_band(-1 - L10_lo, L06_lo)), bit32_bxor(L10_lo, bit32_band(-1 - L06_lo, L07_lo)), bit32_bxor(L06_lo, bit32_band(-1 - L07_lo, L08_lo)), bit32_bxor(L07_lo, bit32_band(-1 - L08_lo, L09_lo)), bit32_bxor(L08_lo, bit32_band(-1 - L09_lo, L10_lo))
			L06_hi, L07_hi, L08_hi, L09_hi, L10_hi = bit32_bxor(L09_hi, bit32_band(-1 - L10_hi, L06_hi)), bit32_bxor(L10_hi, bit32_band(-1 - L06_hi, L07_hi)), bit32_bxor(L06_hi, bit32_band(-1 - L07_hi, L08_hi)), bit32_bxor(L07_hi, bit32_band(-1 - L08_hi, L09_hi)), bit32_bxor(L08_hi, bit32_band(-1 - L09_hi, L10_hi))
			L11_lo, L12_lo, L13_lo, L14_lo, L15_lo = bit32_bxor(L12_lo, bit32_band(-1 - L13_lo, L14_lo)), bit32_bxor(L13_lo, bit32_band(-1 - L14_lo, L15_lo)), bit32_bxor(L14_lo, bit32_band(-1 - L15_lo, L11_lo)), bit32_bxor(L15_lo, bit32_band(-1 - L11_lo, L12_lo)), bit32_bxor(L11_lo, bit32_band(-1 - L12_lo, L13_lo))
			L11_hi, L12_hi, L13_hi, L14_hi, L15_hi = bit32_bxor(L12_hi, bit32_band(-1 - L13_hi, L14_hi)), bit32_bxor(L13_hi, bit32_band(-1 - L14_hi, L15_hi)), bit32_bxor(L14_hi, bit32_band(-1 - L15_hi, L11_hi)), bit32_bxor(L15_hi, bit32_band(-1 - L11_hi, L12_hi)), bit32_bxor(L11_hi, bit32_band(-1 - L12_hi, L13_hi))
			L16_lo, L17_lo, L18_lo, L19_lo, L20_lo = bit32_bxor(L20_lo, bit32_band(-1 - L16_lo, L17_lo)), bit32_bxor(L16_lo, bit32_band(-1 - L17_lo, L18_lo)), bit32_bxor(L17_lo, bit32_band(-1 - L18_lo, L19_lo)), bit32_bxor(L18_lo, bit32_band(-1 - L19_lo, L20_lo)), bit32_bxor(L19_lo, bit32_band(-1 - L20_lo, L16_lo))
			L16_hi, L17_hi, L18_hi, L19_hi, L20_hi = bit32_bxor(L20_hi, bit32_band(-1 - L16_hi, L17_hi)), bit32_bxor(L16_hi, bit32_band(-1 - L17_hi, L18_hi)), bit32_bxor(L17_hi, bit32_band(-1 - L18_hi, L19_hi)), bit32_bxor(L18_hi, bit32_band(-1 - L19_hi, L20_hi)), bit32_bxor(L19_hi, bit32_band(-1 - L20_hi, L16_hi))
			L21_lo, L22_lo, L23_lo, L24_lo, L25_lo = bit32_bxor(L23_lo, bit32_band(-1 - L24_lo, L25_lo)), bit32_bxor(L24_lo, bit32_band(-1 - L25_lo, L21_lo)), bit32_bxor(L25_lo, bit32_band(-1 - L21_lo, L22_lo)), bit32_bxor(L21_lo, bit32_band(-1 - L22_lo, L23_lo)), bit32_bxor(L22_lo, bit32_band(-1 - L23_lo, L24_lo))
			L21_hi, L22_hi, L23_hi, L24_hi, L25_hi = bit32_bxor(L23_hi, bit32_band(-1 - L24_hi, L25_hi)), bit32_bxor(L24_hi, bit32_band(-1 - L25_hi, L21_hi)), bit32_bxor(L25_hi, bit32_band(-1 - L21_hi, L22_hi)), bit32_bxor(L21_hi, bit32_band(-1 - L22_hi, L23_hi)), bit32_bxor(L22_hi, bit32_band(-1 - L23_hi, L24_hi))
			L01_lo = bit32_bxor(L01_lo, RC_lo[round_idx])
			L01_hi = L01_hi + RC_hi[round_idx] -- RC_hi[] is either 0 or 0x80000000, so we could use fast addition instead of slow XOR
		end

		lanes_lo[1] = L01_lo
		lanes_hi[1] = L01_hi
		lanes_lo[2] = L02_lo
		lanes_hi[2] = L02_hi
		lanes_lo[3] = L03_lo
		lanes_hi[3] = L03_hi
		lanes_lo[4] = L04_lo
		lanes_hi[4] = L04_hi
		lanes_lo[5] = L05_lo
		lanes_hi[5] = L05_hi
		lanes_lo[6] = L06_lo
		lanes_hi[6] = L06_hi
		lanes_lo[7] = L07_lo
		lanes_hi[7] = L07_hi
		lanes_lo[8] = L08_lo
		lanes_hi[8] = L08_hi
		lanes_lo[9] = L09_lo
		lanes_hi[9] = L09_hi
		lanes_lo[10] = L10_lo
		lanes_hi[10] = L10_hi
		lanes_lo[11] = L11_lo
		lanes_hi[11] = L11_hi
		lanes_lo[12] = L12_lo
		lanes_hi[12] = L12_hi
		lanes_lo[13] = L13_lo
		lanes_hi[13] = L13_hi
		lanes_lo[14] = L14_lo
		lanes_hi[14] = L14_hi
		lanes_lo[15] = L15_lo
		lanes_hi[15] = L15_hi
		lanes_lo[16] = L16_lo
		lanes_hi[16] = L16_hi
		lanes_lo[17] = L17_lo
		lanes_hi[17] = L17_hi
		lanes_lo[18] = L18_lo
		lanes_hi[18] = L18_hi
		lanes_lo[19] = L19_lo
		lanes_hi[19] = L19_hi
		lanes_lo[20] = L20_lo
		lanes_hi[20] = L20_hi
		lanes_lo[21] = L21_lo
		lanes_hi[21] = L21_hi
		lanes_lo[22] = L22_lo
		lanes_hi[22] = L22_hi
		lanes_lo[23] = L23_lo
		lanes_hi[23] = L23_hi
		lanes_lo[24] = L24_lo
		lanes_hi[24] = L24_hi
		lanes_lo[25] = L25_lo
		lanes_hi[25] = L25_hi
	end
end


Prompt: --// V key, Takedown

Response:
mouse.KeyDown:connect(function(key)
	if key=="v" then
		veh.Lightbar.middle.Beep:Play()
		veh.Lightbar.Remotes.TakedownEvent:FireServer(true)
	end
end)


Prompt: --[[Driver Handling]]

Response:
	--Driver Sit
	car.DriveSeat.ChildAdded:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
			--Distribute Client Interface
			local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
			car.Body.MainPart.Anchored = false
			car.DriveSeat:SetNetworkOwner(p)
			local g=script.Parent["A-Chassis Interface"]:Clone()
			g.Parent=p.PlayerGui
		end
	end)

	--Driver Leave
	car.DriveSeat.ChildRemoved:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") then
			--Remove Flip Force
			if car.DriveSeat:FindFirstChild("Flip")~=nil then
				car.DriveSeat.Flip.MaxTorque = Vector3.new()
			end

			--Remove Wheel Force
			for i,v in pairs(car.Wheels:GetChildren()) do
				if v:FindFirstChild("#AV")~=nil then
					if v["#AV"]:IsA("BodyAngularVelocity") then
						if v["#AV"].AngularVelocity.Magnitude>0 then
							v["#AV"].AngularVelocity = Vector3.new()
							v["#AV"].MaxTorque = Vector3.new()
						end
					else
						if v["#AV"].AngularVelocity>0 then
							v["#AV"].AngularVelocity = 0
							v["#AV"].MotorMaxTorque = 0
						end
					end
				end
			end
		end


Prompt: -- Get the UI frame by name or reference

Response: local uiFrame = script.Parent.Parent.Background.DesktopIcons


Prompt: -- SETUP ICON TEMPLATE

Response:
local topbarPlusGui = Instance.new("ScreenGui")
topbarPlusGui.Enabled = true
topbarPlusGui.DisplayOrder = 0
topbarPlusGui.IgnoreGuiInset = true
topbarPlusGui.ResetOnSpawn = false
topbarPlusGui.Name = "TopbarPlus"

local activeItems = Instance.new("Folder")
activeItems.Name = "ActiveItems"
activeItems.Parent = topbarPlusGui

local topbarContainer = Instance.new("Frame")
topbarContainer.BackgroundTransparency = 1
topbarContainer.Name = "TopbarContainer"
topbarContainer.Position = UDim2.new(0, 0, 0, 0)
topbarContainer.Size = UDim2.new(1, 0, 0, 36)
topbarContainer.Visible = true
topbarContainer.ZIndex = 1
topbarContainer.Parent = topbarPlusGui
topbarContainer.Active = false

local iconContainer = Instance.new("Frame")
iconContainer.BackgroundTransparency = 1
iconContainer.Name = "IconContainer"
iconContainer.Position = UDim2.new(0, 104, 0, 4)
iconContainer.Visible = false
iconContainer.ZIndex = 1
iconContainer.Parent = topbarContainer
iconContainer.Active = false

local iconButton = Instance.new("TextButton")
iconButton.Name = "IconButton"
iconButton.Visible = true
iconButton.Text = ""
iconButton.ZIndex = 10--2
iconButton.BorderSizePixel = 0
iconButton.AutoButtonColor = false
iconButton.Parent = iconContainer
iconButton.Active = true

local iconImage = Instance.new("ImageLabel")
iconImage.BackgroundTransparency = 1
iconImage.Name = "IconImage"
iconImage.AnchorPoint = Vector2.new(0, 0.5)
iconImage.Visible = true
iconImage.ZIndex = 11--3
iconImage.ScaleType = Enum.ScaleType.Fit
iconImage.Parent = iconButton
iconImage.Active = false

local iconLabel = Instance.new("TextLabel")
iconLabel.BackgroundTransparency = 1
iconLabel.Name = "IconLabel"
iconLabel.AnchorPoint = Vector2.new(0, 0.5)
iconLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
iconLabel.Text = ""
iconLabel.RichText = true
iconLabel.TextScaled = false
iconLabel.ClipsDescendants = true
iconLabel.ZIndex = 11--3
iconLabel.Parent = iconButton
iconLabel.Active = false

local iconGradient = Instance.new("UIGradient")
iconGradient.Name = "IconGradient"
iconGradient.Enabled = true
iconGradient.Parent = iconButton

local iconCorner = Instance.new("UICorner")
iconCorner.Name = "IconCorner"
iconCorner.Parent = iconButton

local iconOverlay = Instance.new("Frame")
iconOverlay.Name = "IconOverlay"
iconOverlay.BackgroundTransparency = 1
iconOverlay.Position = iconButton.Position
iconOverlay.Size = UDim2.new(1, 0, 1, 0)
iconOverlay.Visible = true
iconOverlay.ZIndex = iconButton.ZIndex + 1
iconOverlay.BorderSizePixel = 0
iconOverlay.Parent = iconContainer
iconOverlay.Active = false

local iconOverlayCorner = iconCorner:Clone()
iconOverlayCorner.Name = "IconOverlayCorner"
iconOverlayCorner.Parent = iconOverlay


Response:
local buttons = script.Parent.Parent.Buttons
local title = script.Parent.Parent.Title
local popups = script.Parent.Parent.PopUps
local fade = script.Parent.Parent.Fade
local gameVersion = script.Parent.Parent.GameVersion

local playButton = buttons.Play
local settingsButton = buttons.Settings
local infoButton = buttons.Info
local creditsButton = buttons.Credits
local shopButton = buttons.Shop

local settingsPopup = popups.Settings
local infoPopup = popups.Info
local creditsPopup = popups.Credits
local shopPopup = popups.Shop


Prompt: -- Public Methods

Response:
function DropdownClass:Set(option)
	if (self._Selected ~= option) then
		self._Selected = option
		self._ChangedBind:Fire(option)
		self.Button.Option.Text = option.Text
	end
	self:Show(false)
end

function DropdownClass:Get()
	return self._Selected
end

function DropdownClass:Show(bool)
	self.Button.Arrow.Image = bool and ARROW_UP or ARROW_DOWN
	self.ListFrame.Visible = bool
end

function DropdownClass:Destroy()
	self._Maid:Sweep()
	self._ChangedBind:Destroy()
	self._Changed = nil
	self._Options = nil
	self._Selected = nil
end


Prompt: -- its best to anchor while welding, and then unanchor when finished

Response:
function weld(modelgroup,anchored,cancollide)
	local parts,last = {}
	local function scan(parent)
		for _,v in pairs(parent:GetChildren()) do
			if (v:IsA("BasePart")) then
				if (last) then
					local w = Instance.new("Weld")
					w.Name = ("Weld")
					w.Part0,w.Part1 = last,v
					w.C0 = last.CFrame:inverse()
					w.C1 = v.CFrame:inverse()
					w.Parent = last
				end
				last = v
				table.insert(parts,v)
			end
			scan(v)
		end
	end
	scan(modelgroup)
	for _,v in pairs(parts) do
		v.Anchored=anchored
		v.CanCollide=cancollide
	end
end

weld(script.Parent,true,false)


Prompt: -- << SETTINGS >>

Response:
Settings={
	-- <Prefix>
	Prefix			=";" ;			-- The character used to begin each command

	-- <Owner chat colour>
	OwnerChatColour = "y" ;			--w/r/g/b/p/y    OR    white/red/green/blue/purple/yellow

	-- <Donor Perks>   **Please keep enabled to help support the development of HD Admin Commands**
	DonorItem 		= true ;
	DonorItemId 	= 10472779 ;
	DonorCommands 	= true ;

	-- <Other>
	CmdBar			= true ;		-- Enabled/disales the cmdbar - press @ to open the cmdbar
	HDIcon			= true ;		-- The HD Icon in the corner of screen (helps support the development HD Admin Commands)
	AutoPrompt		= true ;		-- This prompts all players to take a free copy of the model. Set to 'false' to disable.
	FreeAdmin		= false ;		-- Allows everyone in server to have the chosen admin. e.g.' FreeAdmin = "VIP" '. Set to False if not. You can not set to 'Owner'.
	NoticeSound		= 261082034 ;	-- Notification sound ID
	NoticeSoundVol	= 0.5 ;			-- How loud the notification sound is. Must be between 0 and 1.
	ErrorSound		= 138090596 ;	-- Error sound ID
	ErrorSoundVol	= 0.5 ;			-- How loud the error sound is. Must be between 0 and 1.
}																																																											;


Prompt: --Mute players across different servers

Response:
local muteConnection = ms:SubscribeAsync(muteTopic, function(message)
	local targetId = message.Data[1]
	local muteLength = message.Data[2]

	for i, plr in pairs(game.Players:GetPlayers()) do
		if plr.UserId == targetId then

			channel:MuteSpeaker(plr.Name)

			task.wait(muteLength)
			if plr then
				channel:UnmuteSpeaker(plr.Name)
			end
		end
	end
end)


Prompt: -- REMOTES --

Response: local Replicate = Remotes.Replicate


Prompt: -- Key that user can press to interact with game

Response:
local KEY1
if IS_MOBILE then
	KEY1 = nil
elseif IS_CONSOLE then
	KEY1 = Enum.KeyCode.ButtonX
else
	KEY1 = Enum.KeyCode.E
end


Prompt: --------------------[ TWEEN FUNCTIONS ]-----------------------------------------------

Response:
function TweenJoint(Joint, NewC0, NewC1, Alpha, Duration)
	coroutine.resume(coroutine.create(function()
		local TweenIndicator = nil --At the current moment, this is how the script determines whether the function is already tweening a joint
		local NewCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
		if (not Joint:FindFirstChild("TweenCode")) then --If the joint isn't being tweened, then
			TweenIndicator = Instance.new("IntValue")
			TweenIndicator.Name = "TweenCode"
			TweenIndicator.Value = NewCode
			TweenIndicator.Parent = Joint
		else
			TweenIndicator = Joint.TweenCode
			TweenIndicator.Value = NewCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
		end
		local MatrixCFrame = function(CFPos, CFTop, CFBack)
			local CFRight = CFTop:Cross(CFBack)
			return CF(
				CFPos.x, CFPos.y, CFPos.z,
				CFRight.x, CFTop.x, CFBack.x,
				CFRight.y, CFTop.y, CFBack.y,
				CFRight.z, CFTop.z, CFBack.z
			)
		end
		local LerpCF = function(StartCF, EndCF, Alpha)
			local StartTop = (StartCF * CFANG(RAD(90), 0, 0)).lookVector
			local StartBack = -StartCF.lookVector
			local EndTop = (EndCF * CFANG(RAD(90), 0, 0)).lookVector
			local EndBack = -EndCF.lookVector
			local StartPos = StartCF.p
			local EndPos = EndCF.p
			local NewCF = MatrixCFrame(
				StartPos:lerp(EndPos, Alpha),
				StartTop:lerp(EndTop, Alpha),
				StartBack:lerp(EndBack, Alpha)
			)
			return NewCF
		end
		local StartC0 = Joint.C0
		local StartC1 = Joint.C1
		local X = 0
		while true do
			local NewX = X + math.min(1.5 / math.max(Duration, 0), 90)
			X = (NewX > 90 and 90 or NewX)
			if TweenIndicator.Value ~= NewCode then break end --This makes sure that another tween wasn't called on the same joint
			if (not Selected) then break end --This stops the tween if the tool is deselected
			if NewC0 then Joint.C0 = LerpCF(StartC0, NewC0, Alpha(X)) end
			if NewC1 then Joint.C1 = LerpCF(StartC1, NewC1, Alpha(X)) end
			if X == 90 then break end
			RS:wait() --This makes the for loop step every 1/60th of a second
		end
		if TweenIndicator.Value == NewCode then --If this tween functions was the last one called on a joint then it will remove the code
			TweenIndicator:Destroy()
		end
	end))
end

INSERT(Connections, RS:connect(function()
			local Forward = (Keys["w"] or Keys[string.char(17)])
			local Backward = (Keys["s"] or Keys[string.char(18)])
			local Right = (Keys["d"] or Keys[string.char(19)])
			local Left = (Keys["a"] or Keys[string.char(20)])

			local WalkingForward = (Forward and (not Backward))
			local WalkingBackward = ((not Forward) and Backward)
			local WalkingRight = (Right and (not Left))
			local WalkingLeft = ((not Right) and Left)
		end))

		INSERT(Connections, RS:connect(function()
			if (not Idleing) and Walking then
					if Stance == 1 then
						Humanoid.WalkSpeed = 7
					elseif Stance == 2 then
						Humanoid.WalkSpeed = 16
					end
			else
				Humanoid.WalkSpeed = 16
			end
		end))