Prompt:
--[[
local dataStore = game:GetService("DataStoreService") -- gets the data store service
local data = dataStore:GetDataStore("Stats") -- makes a new data stored named "stats"

game.Players.PlayerAdded:Connect(function(plr) -- when a player joins the game

	local leaderstats = Instance.new("Folder") -- we make a leaderstats that will hold the visible stats of a player
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = plr

	local Clicks = Instance.new("NumberValue") -- we make a stat named coins, you can name it whatever you want
	Clicks.Name = "Clicks"
	Clicks.Parent = leaderstats

	local Rebirths = Instance.new("NumberValue")  -- we make a second stat named xp, you can also name it whatever you want instead
	Rebirths.Name = "Rebirths"
	Rebirths.Parent = leaderstats

	local Gems = Instance.new("NumberValue")  -- we make a second stat named xp, you can also name it whatever you want instead
	Gems.Name = "Gems"
	Gems.Parent = leaderstats

	local Clicks
	local Rebirths
	local Gems

	Clicks = data:GetAsync(plr.UserId.."-Clicks")
	-- ^^ we see if the the coin stat has been saved in the players key (their user ID) and we save coins in the "Coins" data key so we know we know we are saving coins

	Rebirths =  data:GetAsync(plr.UserId.."-Rebirths")-- same as the top except its with the xp stat

	Gems =  data:GetAsync(plr.UserId.."-Gems")-- same as the top except its with the xp stat

	if Clicks ~= nil then -- if the player has coins saved (more than 0)

		plr.leaderstats.Clicks.Value = Clicks

	end

	if Rebirths ~= nil then  -- if the player has xp saved (more than 0)

		plr.leaderstats.Rebirths.Value = Rebirths

	end

	if Gems ~= nil then  -- if the player has xp saved (more than 0)

		plr.leaderstats.Gems.Value = Gems

	end
end)

game.Players.PlayerRemoving:Connect(function(plr) -- when the players leave

	local sucess, errormsg = pcall(function() -- pcall function helps the script to contain the error if there is one instead of breaking the entire script

		data:SetAsync(plr.UserId.."-Clicks", plr.leaderstats.Clicks.Value) -- the players stats will be set to the players sync for coins

		data:SetAsync(plr.UserId.."-Rebirths", plr.leaderstats.Rebirths.Value) --  same thing but with the xp stat

		data:SetAsync(plr.UserId.."-Gems", plr.leaderstats.Gems.Value) --  same thing but with the xp stat

	end)

	if errormsg then -- if theres an error with the data store

		warn("error")
	end

end)

--]]


Prompt: -- map a value from one range to another

Response:
local function map(x, inMin, inMax, outMin, outMax)
	return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin
end

local function playSound(sound)
	sound.TimePosition = 0
	sound.Playing = true
end

local function stopSound(sound)
	sound.Playing = false
	sound.TimePosition = 0
end

local function initializeSoundSystem(player, humanoid, rootPart)
	local sounds = {}

	-- initialize sounds
	for name, props in pairs(SOUND_DATA) do
		local sound = Instance.new("Sound")
		sound.Name = name

		-- set default values
		sound.Archivable = false
		sound.EmitterSize = 5
		sound.MaxDistance = 150
		sound.Volume = 0.65

		for propName, propValue in pairs(props) do
			sound[propName] = propValue
		end

		sound.Parent = rootPart
		sounds[name] = sound
	end

	local playingLoopedSounds = {}

	local function stopPlayingLoopedSounds(except)
		for sound in pairs(playingLoopedSounds) do
			if sound ~= except then
				sound.Playing = false
				playingLoopedSounds[sound] = nil
			end
		end
	end

	-- state transition callbacks
	local stateTransitions = {
		[Enum.HumanoidStateType.FallingDown] = function()
			stopPlayingLoopedSounds()
		end,

		[Enum.HumanoidStateType.GettingUp] = function()
			stopPlayingLoopedSounds()
			playSound(sounds.GettingUp)
		end,

		[Enum.HumanoidStateType.Jumping] = function()
			stopPlayingLoopedSounds()
			playSound(sounds.Jumping)
		end,

		[Enum.HumanoidStateType.Swimming] = function()
			local verticalSpeed = math.abs(rootPart.Velocity.Y)
			if verticalSpeed > 0.1 then
				sounds.Splash.Volume = math.clamp(map(verticalSpeed, 100, 350, 0.28, 1), 0, 1)
				playSound(sounds.Splash)
			end
			stopPlayingLoopedSounds(sounds.Swimming)
			sounds.Swimming.Playing = true
			playingLoopedSounds[sounds.Swimming] = true
		end,

		[Enum.HumanoidStateType.Freefall] = function()
			sounds.FreeFalling.Volume = 0
			stopPlayingLoopedSounds(sounds.FreeFalling)
			playingLoopedSounds[sounds.FreeFalling] = true
		end,

		[Enum.HumanoidStateType.Landed] = function()
			stopPlayingLoopedSounds()
			local verticalSpeed = math.abs(rootPart.Velocity.Y)
			if verticalSpeed > 75 then
				sounds.Landing.Volume = math.clamp(map(verticalSpeed, 50, 100, 0, 1), 0, 1)
				playSound(sounds.Landing)
			end
		end,

		[Enum.HumanoidStateType.Running] = function()
			stopPlayingLoopedSounds(sounds.Running)
			sounds.Running.Playing = true
			playingLoopedSounds[sounds.Running] = true
		end,

		[Enum.HumanoidStateType.Climbing] = function()
			local sound = sounds.Climbing
			if math.abs(rootPart.Velocity.Y) > 0.1 then
				sound.Playing = true
				stopPlayingLoopedSounds(sound)
			else
				stopPlayingLoopedSounds()
			end
			playingLoopedSounds[sound] = true
		end,

		[Enum.HumanoidStateType.Seated] = function()
			stopPlayingLoopedSounds()
		end,

		[Enum.HumanoidStateType.Dead] = function()
			stopPlayingLoopedSounds()
			playSound(sounds.Died)
		end,
	}

	-- updaters for looped sounds
	local loopedSoundUpdaters = {
		[sounds.Climbing] = function(dt, sound, vel)
			sound.Playing = vel.Magnitude > 0.1
		end,

		[sounds.FreeFalling] = function(dt, sound, vel)
			if vel.Magnitude > 75 then
				sound.Volume = math.clamp(sound.Volume + 0.9*dt, 0, 1)
			else
				sound.Volume = 0
			end
		end,

		[sounds.Running] = function(dt, sound, vel)
		--sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5

		sound.SoundId = ""
		sound.PlaybackSpeed = 0
		sound.Volume = 0
		sound.EmitterSize = 0
		end,
	}

	-- state substitutions to avoid duplicating entries in the state table
	local stateRemap = {
		[Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running,
	}

	local activeState = stateRemap[humanoid:GetState()] or humanoid:GetState()
	local activeConnections = {}

	local stateChangedConn = humanoid.StateChanged:Connect(function(_, state)
		state = stateRemap[state] or state

		if state ~= activeState then
			local transitionFunc = stateTransitions[state]

			if transitionFunc then
				transitionFunc()
			end

			activeState = state
		end
	end)

	local steppedConn = RunService.Stepped:Connect(function(_, worldDt)
		-- update looped sounds on stepped
		for sound in pairs(playingLoopedSounds) do
			local updater = loopedSoundUpdaters[sound]

			if updater then
				updater(worldDt, sound, rootPart.Velocity)
			end
		end
	end)

	local humanoidAncestryChangedConn
	local rootPartAncestryChangedConn
	local characterAddedConn

	local function terminate()
		stateChangedConn:Disconnect()
		steppedConn:Disconnect()
		humanoidAncestryChangedConn:Disconnect()
		rootPartAncestryChangedConn:Disconnect()
		characterAddedConn:Disconnect()
	end

	humanoidAncestryChangedConn = humanoid.AncestryChanged:Connect(function(_, parent)
		if not parent then
			terminate()
		end
	end)

	rootPartAncestryChangedConn = rootPart.AncestryChanged:Connect(function(_, parent)
		if not parent then
			terminate()
		end
	end)

	characterAddedConn = player.CharacterAdded:Connect(terminate)
end

local function playerAdded(player)
	local function characterAdded(character)
		-- Avoiding memory leaks in the face of Character/Humanoid/RootPart lifetime has a few complications:
		-- * character deparenting is a Remove instead of a Destroy, so signals are not cleaned up automatically.
		-- ** must use a waitForFirst on everything and listen for hierarchy changes.
		-- * the character might not be in the dm by the time CharacterAdded fires
		-- ** constantly check consistency with player.Character and abort if CharacterAdded is fired again
		-- * Humanoid may not exist immediately, and by the time it's inserted the character might be deparented.
		-- * RootPart probably won't exist immediately.
		-- ** by the time RootPart is inserted and Humanoid.RootPart is set, the character or the humanoid might be deparented.

		if not character.Parent then
			waitForFirst(character.AncestryChanged, player.CharacterAdded)
		end

		if player.Character ~= character or not character.Parent then
			return
		end

		local humanoid = character:FindFirstChildOfClass("Humanoid")
		while character:IsDescendantOf(game) and not humanoid do
			waitForFirst(character.ChildAdded, character.AncestryChanged, player.CharacterAdded)
			humanoid = character:FindFirstChildOfClass("Humanoid")
		end

		if player.Character ~= character or not character:IsDescendantOf(game) then
			return
		end

		-- must rely on HumanoidRootPart naming because Humanoid.RootPart does not fire changed signals
		local rootPart = character:FindFirstChild("HumanoidRootPart")
		while character:IsDescendantOf(game) and not rootPart do
			waitForFirst(character.ChildAdded, character.AncestryChanged, humanoid.AncestryChanged, player.CharacterAdded)
			rootPart = character:FindFirstChild("HumanoidRootPart")
		end

		if rootPart and humanoid:IsDescendantOf(game) and character:IsDescendantOf(game) and player.Character == character then
			initializeSoundSystem(player, humanoid, rootPart)
		end
	end

	if player.Character then
		characterAdded(player.Character)
	end
	player.CharacterAdded:Connect(characterAdded)
end

Players.PlayerAdded:Connect(playerAdded)
for _, player in ipairs(Players:GetPlayers()) do
	playerAdded(player)
end

repeat
	wait()
until game.Players.LocalPlayer.Character

local Character = game.Players.LocalPlayer.Character
local Head = Character:WaitForChild("HumanoidRootPart")
local RunningSound = Head:WaitForChild("Running")
local Humanoid = Character:WaitForChild("Humanoid")
local vel = 0

Humanoid.Changed:Connect(function(property)

end)

Humanoid.Running:connect(function(a)
		RunningSound.PlaybackSpeed 	= 1
		RunningSound.Volume 		= 0
		RunningSound.EmitterSize 	= 0
		vel 						= a
end)


Prompt:
--- Creates a new spring
-- @param initial A number or Vector3 (anything with * number and addition/subtraction defined)
-- @param[opt=tick] clock function to use to update spring

Response:
function Spring.new(initial, clock)
	local target = initial or 0
	clock = clock or tick
	return setmetatable({
		_clock = clock;
		_time0 = clock();
		_position0 = target;
		_velocity0 = 0*target;
		_target = target;
		_damper = 1;
		_speed = 1;
	}, Spring)
end


Prompt:
--[[
	An implementation of Promises similar to Promise/A+.
]]

Response:
local ERROR_NON_PROMISE_IN_LIST = "Non-promise value passed into %s at index %s"
local ERROR_NON_LIST = "Please pass a list of promises to %s"
local ERROR_NON_FUNCTION = "Please pass a handler function to %s!"
local MODE_KEY_METATABLE = { __mode = "k" }

local function isCallable(value)
	if type(value) == "function" then
		return true
	end

	if type(value) == "table" then
		local metatable = getmetatable(value)
		if metatable and type(rawget(metatable, "__call")) == "function" then
			return true
		end
	end

	return false
end


Prompt:
--[=[
	@within Plasma
	@function portal
	@tag widgets
	@param targetInstance Instance -- Where the portal goes to
	@param children () -> () -- Children

	The portal widget creates its children inside the specified `targetInstance`. For example, you could use this
	to create lighting effects in Lighting as a widget:

	```lua
	return function(size)
		portal(Lighting, function()
			useInstance(function()
				local blur = Instance.new("BlurEffect")
				blur.Size = size
				return blur
			end)
		end)
	end
	```
]=]

Response:
local Runtime = require(script.Parent.Parent.Runtime)

return Runtime.widget(function(targetInstance, fn)
	Runtime.useInstance(function()
		return nil, targetInstance
	end)

	Runtime.scope(fn)
end)


Prompt: --Starter Character Scripts

Response:
local MaxSpeed = 70
while true do
	wait()
	if script.Parent.Humanoid.MoveDirection == Vector3.new(0,0,0) then
		script.Parent.Humanoid.WalkSpeed = 1
	else
		script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + .4
		if script.Parent.Humanoid.WalkSpeed >= MaxSpeed then
		script.Parent.Humanoid.WalkSpeed = MaxSpeed
		end
	end
end


Prompt:
--[=[
	@return Trove
	Creates and adds another trove to itself. This is just shorthand
	for `trove:Construct(Trove)`. This is useful for contexts where
	the trove object is present, but the class itself isn't.

	:::note
	This does _not_ clone the trove. In other words, the objects in the
	trove are not given to the new constructed trove. This is simply to
	construct a new Trove and add it as an object to track.
	:::

	```lua
	local trove = Trove.new()
	local subTrove = trove:Extend()

	trove:Clean() -- Cleans up the subTrove too
	```
]=]

Response:
function Trove:Extend()
	if self._cleaning then
		error("Cannot call trove:Extend() while cleaning", 2)
	end
	return self:Construct(Trove)
end


Prompt:
--[=[
	Throttles emission of observables.

	https://rxjs-dev.firebaseapp.com/api/operators/debounceTime

	:::note
	Note that on complete, the last item is not included, for now, unlike the existing version in rxjs.
	:::

	@param duration number
	@param throttleConfig { leading = true; trailing = true; }
	@return (source: Observable) -> Observable
]=]

Response:
function Rx.throttleTime(duration, throttleConfig)
	assert(type(duration) == "number", "Bad duration")
	assert(type(throttleConfig) == "table" or throttleConfig == nil, "Bad throttleConfig")

	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

		return Observable.new(function(sub)
			local maid = Maid.new()

			local throttledFunction = ThrottledFunction.new(duration, function(...)
				sub:Fire(...)
			end, throttleConfig)

			maid:GiveTask(throttledFunction)
			maid:GiveTask(source:Subscribe(function(...)
				throttledFunction:Call(...)
			end, sub:GetFailComplete()))

			return maid
		end)
	end
end


Prompt:
--[[
		___      _______                _
	   / _ |____/ ___/ /  ___ ____ ___ (_)__
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]

Response:
local car = script.Parent.Car.Value
local vl = script.Parent.Values

local strength = 350

local max = 8 --in sps

while wait() do
	if (vl.Throttle.Value < 0.1 and vl.RPM.Value > 0 and vl.Velocity.Value.Magnitude < max and (math.abs(vl.Gear.Value) > 0)) and vl.Brake.Value == 0 then
		car.Body.Creep.BV.MaxForce = Vector3.new(strength,0,strength)
	else
		car.Body.Creep.BV.MaxForce = Vector3.new(0,0,0)
	end
	car.Body.Creep.BV.Velocity = car.Body.Creep.CFrame.lookVector*(8*(math.min(vl.Gear.Value,1)))
end


Prompt: --// Damage Settings

Response:
	BaseDamage = 20; -- Torso Damage
	LimbDamage = 18; -- Arms and Legs
	ArmorDamage = 15; -- How much damage is dealt against armor (Name the armor "Armor")
	HeadDamage = 38; -- If you set this to 100, there's a chance the player won't die because of the heal script


Prompt:
--[=[
	@function first
	@within Array

	@param array {T} -- The array to get the first item from.
	@return T -- The first item in the array.

	Gets the first item in the array.

	```lua
	local array = { 1, 2, 3 }

	local value = First(array) -- 1
	```
]=]

Response:
local function first<T>(array: { T }): T
	return At(array, 1)
end

return first


Prompt: -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000

Response:
function RayCast(startPos, vec, rayLength)
	local hitObject, hitPos = workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
	if hitObject and hitPos then
		local distance = rayLength - (hitPos - startPos).magnitude
		if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
			-- there is a chance here for potential infinite recursion
			return RayCast(hitPos, vec, distance)
		end
	end
	return hitObject, hitPos
end

function TagHumanoid(humanoid, player)
	-- Add more tags here to customize what tags are available.
	while humanoid:FindFirstChild('creator') do
		humanoid:FindFirstChild('creator'):Destroy()
	end
	local creatorTag = Instance.new("ObjectValue")
	creatorTag.Value = player
	creatorTag.Name = "creator"
	creatorTag.Parent = humanoid
	DebrisService:AddItem(creatorTag, 1.5)

	local weaponIconTag = Instance.new("StringValue")
	weaponIconTag.Value = IconURL
	weaponIconTag.Name = "icon"
	weaponIconTag.Parent = creatorTag
end

local function CreateFlash()
	if FlashHolder then
		local flash = Instance.new('Fire', FlashHolder)
		flash.Color = Color3.new(1, 140 / 255, 0)
		flash.SecondaryColor = Color3.new(1, 0, 0)
		flash.Size = 0.3
		DebrisService:AddItem(flash, FireRate / 1.5)
	else
		FlashHolder = Instance.new("Part", Tool)
		FlashHolder.Transparency = 1
		FlashHolder.CanCollide= false
		FlashHolder.Size = Vector3.new(1, 1, 1)
		FlashHolder.Position = Tool.Handle.Position
		local Weld = Instance.new("ManualWeld")
		Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
		Weld.C1 = CFrame.new(0, 2.2, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0)
		Weld.Part0 = FlashHolder
		Weld.Part1 = Tool.Handle
		Weld.Parent = FlashHolder
	end
end

local function CreateBullet(bulletPos)
	local bullet = Instance.new('Part', workspace)
	bullet.FormFactor = Enum.FormFactor.Custom
	bullet.Size = Vector3.new(0.1, 0.1, 0.1)
	bullet.BrickColor = MyPlayer.TeamColor
	bullet.Shape = Enum.PartType.Ball
	bullet.CanCollide = false
	bullet.CFrame = CFrame.new(bulletPos)
	bullet.Anchored = true
	bullet.TopSurface = Enum.SurfaceType.Smooth
	bullet.BottomSurface = Enum.SurfaceType.Smooth
	bullet.Name = 'Bullet'
	DebrisService:AddItem(bullet, 2.5)
	local fire = Instance.new("Fire", bullet)
	fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
	fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
	fire.Size = 5
	fire.Heat = 0
	DebrisService:AddItem(fire, 0.2)
	return bullet
end

local function Reload()
	if not Reloading then
		Reloading = true
		-- Don't reload if you are already full or have no extra ammo
		if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
			if RecoilTrack then
				RecoilTrack:Stop()
			end
			if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
				if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
					WeaponGui.Crosshair.ReloadingLabel.Visible = true
				end
			end
			wait(ReloadTime)
			-- Only use as much ammo as you have
			local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
			AmmoInClip = AmmoInClip + ammoToUse
			SpareAmmo = SpareAmmo - ammoToUse
			UpdateAmmo(AmmoInClip)
		end
		Reloading = false
	end
end

function OnFire()
	if IsShooting then return end
	if MyHumanoid and MyHumanoid.Health > 0 then
		if RecoilTrack and AmmoInClip > 0 then
			RecoilTrack:Play()
		end
		IsShooting = true
		while LeftButtonDown and AmmoInClip > 0 and not Reloading do
			if Spread and not DecreasedAimLastShot then
				Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
				UpdateCrosshair(Spread)
			end
			DecreasedAimLastShot = not DecreasedAimLastShot
			if Handle:FindFirstChild('FireSound') then
				Handle.FireSound:Play()
			end
			CreateFlash()
			if MyMouse then
				local targetPoint = MyMouse.Hit.p
				local shootDirection = (targetPoint - Handle.Position).unit
				-- Adjust the shoot direction randomly off by a little bit to account for recoil
				shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
																(0.5 - math.random()) * 2 * Spread,
																(0.5 - math.random()) * 2 * Spread) * shootDirection
				local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
				local bullet
				-- Create a bullet here
				if hitObject then
					bullet = CreateBullet(bulletPos)
				end
				if hitObject and hitObject.Parent then
					local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
					if hitHumanoid then
						local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
						if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then
							TagHumanoid(hitHumanoid, MyPlayer)
							hitHumanoid:TakeDamage(Damage)
							if bullet then
								bullet:Destroy()
								bullet = nil
								--bullet.Transparency = 1
							end
							spawn(UpdateTargetHit)
						end
					end
				end

				AmmoInClip = AmmoInClip - 1
				UpdateAmmo(AmmoInClip)
			end
			wait(FireRate)
		end
		IsShooting = false
		if AmmoInClip == 0 then
			Reload()
		end
		if RecoilTrack then
			RecoilTrack:Stop()
		end
	end
end

local TargetHits = 0
function UpdateTargetHit()
	TargetHits = TargetHits + 1
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
		WeaponGui.Crosshair.TargetHitImage.Visible = true
	end
	wait(0.5)
	TargetHits = TargetHits - 1
	if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
		WeaponGui.Crosshair.TargetHitImage.Visible = false
	end
end

function UpdateCrosshair(value, mouse)
	if WeaponGui then
		local absoluteY = 650
		WeaponGui.Crosshair:TweenSize(
			UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
			Enum.EasingDirection.Out,
			Enum.EasingStyle.Linear,
			0.33)
	end
end

function UpdateAmmo(value)
	if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
		WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
		if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
			WeaponGui.Crosshair.ReloadingLabel.Visible = false
		end
	end
	if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
		WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
	end
end

function OnMouseDown()
	LeftButtonDown = true
	OnFire()
end

function OnMouseUp()
	LeftButtonDown = false
end

function OnKeyDown(key)
	if string.lower(key) == 'r' then
		Reload()
	end
end

function OnEquipped(mouse)
	RecoilAnim = WaitForChild(Tool, 'Recoil')
	FireSound  = WaitForChild(Handle, 'FireSound')

	MyCharacter = Tool.Parent
	MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
	MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
	MyTorso = MyCharacter:FindFirstChild('Torso')
	MyMouse = mouse
	WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
	if WeaponGui and MyPlayer then
		WeaponGui.Parent = MyPlayer.PlayerGui
		UpdateAmmo(AmmoInClip)
	end
	if RecoilAnim then
		RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
	end

	if MyMouse then
		-- Disable mouse icon
		MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
		MyMouse.Button1Down:connect(OnMouseDown)
		MyMouse.Button1Up:connect(OnMouseUp)
		MyMouse.KeyDown:connect(OnKeyDown)
	end
end


Prompt: -------- OMG HAX

Response:
r = game:service("RunService")

local damage = 0 + (script.AddDam.Value/4)

local slash_damage = 0 + script.AddDam.Value

sword = script.Parent.Handle
Tool = script.Parent

local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=10730819"
SlashSound.Parent = sword
SlashSound.Volume = 1

local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=12722518"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1

function blow(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Immortal") -- non-nil if tool held by a character
	if humanoid~=nil and humanoid ~= hum and hum ~= nil then
		-- final check, make sure sword is in-hand

		local right_arm = vCharacter:FindFirstChild("Right Arm")
		if (right_arm ~= nil) then
			local joint = right_arm:FindFirstChild("RightGrip")
			if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
				tagHumanoid(humanoid, vPlayer)
				humanoid:TakeDamage(damage)
				wait(1)
				untagHumanoid(humanoid)
			end
		end

	end
end

function tagHumanoid(humanoid, player)
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end

function attack()
	damage = slash_damage
	SlashSound:play()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end

function swordUp()
	Tool.GripForward = Vector3.new(-1,0,0)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
	Tool.GripForward = Vector3.new(0,0,1)
	Tool.GripRight = Vector3.new(0,-1,0)
	Tool.GripUp = Vector3.new(-1,0,0)
end

Tool.Enabled = true

function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Immortal
	if humanoid == nil then
		print("Humanoid not found")
		return
	end

	attack()

	wait(1)

	Tool.Enabled = true
end

function onEquipped()
	UnsheathSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

connection = sword.Touched:connect(blow)


Prompt: --Miscellaneous Settings:

Response:
LEAVE_DISABLE	= true			--Turns off the engine when you leave the car
GEAR_SPEED		= 2.5			--Directly affects cam gear spin speed		(Arbitrary)
SHAKE_ANGLE		= 2.5			--Max angle of the engine shake in degrees
SHAKE_VALUE		= 1.0			--Intensity of the engine shake				(Arbitrary)
MH_THRESHOLD	= 6800			--RPM value in which manifold heats up
MH_COOLDOWN		= 2.5			--Manifold cool down rate
BELT_SPEED		= 5.0			--Speed of the belt							(Arbitrary)
BELT_TEXTURE	= 5503797483	--TextureID of belt in case you did not put it in the TextureID StringValue object
BELT_WIDTH		= 0.1			--Width of belt in case you did not put it in the BeltWidth StringValue object
TURBO_SPEED		= 1.0			--Directly affects turbo fan spin speed		(Arbitrary)
TURBO_BLUR		= true			--Turbo fan motion blur


Prompt: --//INSPARE//--

Response:
local player = game.Players.LocalPlayer
local lightOn = false
local car = script.Parent.Car.Value


Prompt: --[[ Last synced 7/19/2021 08:28                                                                                RoSync Loader ]]

Response: getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[                                                                                ]]--


Prompt: -- Etc

Response:
local DESTROY_ON_DEATH = getValueFromConfig("DestroyOnDeath")
local RAGDOLL_ENABLED = getValueFromConfig("RagdollEnabled")

local DEATH_DESTROY_DELAY = 5
local PATROL_WALKSPEED = 0
local MIN_REPOSITION_TIME = 2
local MAX_REPOSITION_TIME = 10
local MAX_PARTS_PER_HEARTBEAT = 50
local SEARCH_DELAY = 1


Prompt:
-----------------
--| Variables |--
-----------------

Response:
local Tool = script.Parent
local ToolHandle = Tool.Handle

local MyModel = nil
local ReloadRocket = nil

local StillEquipped = false


Prompt: --[[ Public API ]]

Response:
--
function Gamepad:Enable()
	local forwardValue  = 0
	local backwardValue = 0
	local leftValue = 0
	local rightValue = 0

	local moveFunc = LocalPlayer.Move
	local gamepadSupports = UserInputService.GamepadSupports

	local controlCharacterGamepad1 = function(actionName, inputState, inputObject)
		if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end
		if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end

		if hasCancelType and inputState == Enum.UserInputState.Cancel then
			MasterControl:AddToPlayerMovement(-currentMoveVector)
			currentMoveVector =  Vector3.new(0,0,0)
			return
		end

		if inputObject.Position.magnitude > thumbstickDeadzone then
			MasterControl:AddToPlayerMovement(-currentMoveVector)
			currentMoveVector =  Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y)
			MasterControl:AddToPlayerMovement(currentMoveVector)
		else
			MasterControl:AddToPlayerMovement(-currentMoveVector)
			currentMoveVector =  Vector3.new(0,0,0)
		end
	end

	local jumpCharacterGamepad1 = function(actionName, inputState, inputObject)
		if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end
		if inputObject.KeyCode ~= Enum.KeyCode.ButtonA then return end

		if hasCancelType and inputState == Enum.UserInputState.Cancel then
			MasterControl:SetIsJumping(false)
			return
		end

		MasterControl:SetIsJumping(inputObject.UserInputState == Enum.UserInputState.Begin)
	end

	local doDpadMoveUpdate = function()
		if not gamepadSupports(UserInputService, Enum.UserInputType.Gamepad1, Enum.KeyCode.Thumbstick1) then
			if LocalPlayer and LocalPlayer.Character then
				MasterControl:AddToPlayerMovement(-currentMoveVector)
				currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue)
				MasterControl:AddToPlayerMovement(currentMoveVector)
			end
		end
	end

	local moveForwardFunc = function(actionName, inputState, inputObject)
		if inputState == Enum.UserInputState.End then
			forwardValue = -1
		elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
			forwardValue = 0
		end

		doDpadMoveUpdate()
	end

	local moveBackwardFunc = function(actionName, inputState, inputObject)
		if inputState == Enum.UserInputState.End then
			backwardValue = 1
		elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
			backwardValue = 0
		end

		doDpadMoveUpdate()
	end

	local moveLeftFunc = function(actionName, inputState, inputObject)
		if inputState == Enum.UserInputState.End then
			leftValue = -1
		elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
			leftValue = 0
		end

		doDpadMoveUpdate()
	end

	local moveRightFunc = function(actionName, inputState, inputObject)
		if inputState == Enum.UserInputState.End then
			rightValue = 1
		elseif inputState == Enum.UserInputState.Begin or (hasCancelType and inputState == Enum.UserInputState.Cancel) then
			rightValue = 0
		end

		doDpadMoveUpdate()
	end

	ContextActionService:BindAction("JumpButton",jumpCharacterGamepad1, false, Enum.KeyCode.ButtonA)
	ContextActionService:BindAction("MoveThumbstick",controlCharacterGamepad1, false, Enum.KeyCode.Thumbstick1)

	ContextActionService:BindAction("forwardDpad", moveForwardFunc, false, Enum.KeyCode.DPadUp)
	ContextActionService:BindAction("backwardDpad", moveBackwardFunc, false, Enum.KeyCode.DPadDown)
	ContextActionService:BindAction("leftDpad", moveLeftFunc, false, Enum.KeyCode.DPadLeft)
	ContextActionService:BindAction("rightDpad", moveRightFunc, false, Enum.KeyCode.DPadRight)

	ContextActionService:BindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2)

	UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
		if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end

		MasterControl:AddToPlayerMovement(-currentMoveVector)
		currentMoveVector = Vector3.new(0,0,0)
	end)

	UserInputService.GamepadConnected:connect(function(gamepadEnum)
		if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end

		MasterControl:AddToPlayerMovement(-currentMoveVector)
		currentMoveVector = Vector3.new(0,0,0)
	end)
end

function Gamepad:Disable()

	ContextActionService:UnbindAction("forwardDpad")
	ContextActionService:UnbindAction("backwardDpad")
	ContextActionService:UnbindAction("leftDpad")
	ContextActionService:UnbindAction("rightDpad")

	ContextActionService:UnbindAction("MoveThumbstick")
	ContextActionService:UnbindAction("JumpButton")
	ContextActionService:UnbindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2)

	MasterControl:AddToPlayerMovement(-currentMoveVector)
	currentMoveVector = Vector3.new(0,0,0)
	MasterControl:SetIsJumping(false)
end

return Gamepad


Prompt:
--		if userPlayEmoteByIdAnimTrackReturn then
--			return true, currentAnimTrack
--		else
--			return true
--		end
--	elseif typeof(emote) == "Instance" and emote:IsA("Animation") then
--		-- Non-default emotes
--		playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)


Prompt: --[[Weight and CG]]

Response:
	Tune.Weight			= 2963	-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		6		,
	 --[[Height]]		4.4		,
	 --[[Length]]		15		}
	Tune.WeightDist		= 55		-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
	Tune.CGHeight		= 1.3		-- Center of gravity height (studs relative to median of all wheels)
	Tune.WBVisible		= false		-- Makes the weight brick visible

	--Unsprung Weight
	Tune.FWheelDensity	= .1		-- Front Wheel Density
	Tune.RWheelDensity	= .1		-- Rear Wheel Density
	Tune.FWLgcyDensity	= 1			-- Front Wheel Density [PGS OFF]
	Tune.RWLgcyDensity	= 1			-- Rear Wheel Density [PGS OFF]

	Tune.AxleSize		= 2			-- Size of structural members (larger = MORE STABLE / carry more weight)
	Tune.AxleDensity	= .1		-- Density of structural members


Prompt: -- Set camera tilt correction for mobile:

Response:
function CamLock.SetMobileDeviceBank(bank)
	mobileDeviceBank = bank
end


Prompt: -- find player's head pos

Response:
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	local head = vCharacter:findFirstChild("Head")
	if head == nil then return end

	local dir = mouse_pos - head.Position
	dir = computeDirection(dir)

	local launch = head.Position + 5 * dir

	local delta = mouse_pos - launch

	local dy = delta.y

	local new_delta = Vector3.new(delta.x, 0, delta.z)
	delta = new_delta

	local dx = delta.magnitude
	local unit_delta = delta.unit

	-- acceleration due to gravity in RBX units
	local g = (-9.81 * 20)

	local theta = computeLaunchAngle( dx, dy, g)

	local vy = math.sin(theta)
	local xz = math.cos(theta)
	local vx = unit_delta.x * xz
	local vz = unit_delta.z * xz

	local missile = Pellet:clone()

	Tool.Handle.Mesh:clone().Parent = missile

	missile.Position = launch
	missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY

	missile.PelletScript.Disabled = false

	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = vCharacter
	creator_tag.Name = "creator"
	creator_tag.Parent = missile

	missile.Parent = game.Workspace

end

function computeLaunchAngle(dx,dy,grav)
	-- arcane
	-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile

	local g = math.abs(grav)
	local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
	if inRoot <= 0 then
		return .25 * math.pi
	end
	local root = math.sqrt(inRoot)
	local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)

	local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
	local answer1 = math.atan(inATan1)
	local answer2 = math.atan(inATan2)
	if answer1 < answer2 then return answer1 end
	return answer2
end

function computeDirection(vec)
	local lenSquared = vec.magnitude * vec.magnitude
	local invSqrt = 1 / math.sqrt(lenSquared)
	return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end

Tool.Enabled = true
function onActivated()
	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return
	end
if loaded==true then
	loaded=false
	local targetPos = humanoid.TargetPoint

	fire(targetPos)
	wait(.2)
	Tool.Enabled = true
elseif loaded==false then
Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 0.6
Tool.Parent.Torso["Right Shoulder"].DesiredAngle = -3.6
	wait(.1)
Tool.Handle.Transparency=0
wait(.1)
	loaded=true
	end
	Tool.Enabled = true
end

script.Parent.Activated:connect(onActivated)


Prompt:
--[[
	Function called when leaving the state
]]

Response:
function PlayerFinished.leave(stateMachine, playerComponent)
	playerComponent:destroyVehicle()
end

return PlayerFinished


Prompt:
--!strict
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER

Response: return -9007199254740991


Prompt:
--///////////////// Internal-Use Methods
--//////////////////////////////////////
--DO NOT REMOVE THIS. Chat must be filtered or your game will face
--moderation.

Response:
function methods:InternalApplyRobloxFilter(speakerName, message, toSpeakerName) --// USES FFLAG
	if (RunService:IsServer() and not RunService:IsStudio()) then
		local fromSpeaker = self:GetSpeaker(speakerName)
		local toSpeaker = toSpeakerName and self:GetSpeaker(toSpeakerName)

		if fromSpeaker == nil then
			return nil
		end

		local fromPlayerObj = fromSpeaker:GetPlayer()
		local toPlayerObj = toSpeaker and toSpeaker:GetPlayer()

		if fromPlayerObj == nil then
			return message
		end

		if allSpaces(message) then
			return message
		end

		local filterStartTime = tick()
		local filterRetries = 0
		while true do
			local success, message = pcall(function()
				if toPlayerObj then
					return Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj)
				else
					return Chat:FilterStringForBroadcast(message, fromPlayerObj)
				end
			end)
			if success then
				return message
			else
				warn("Error filtering message:", message)
			end
			filterRetries = filterRetries + 1
			if filterRetries > MAX_FILTER_RETRIES or (tick() - filterStartTime) > MAX_FILTER_DURATION then
				self:InternalNotifyFilterIssue()
				return nil
			end
			local backoffInterval = FILTER_BACKOFF_INTERVALS[math.min(#FILTER_BACKOFF_INTERVALS, filterRetries)]
			-- backoffWait = backoffInterval +/- (0 -> backoffInterval)
			local backoffWait = backoffInterval + ((math.random()*2 - 1) * backoffInterval)
			wait(backoffWait)
		end
	else
		--// Simulate filtering latency.
		--// There is only latency the first time the message is filtered, all following calls will be instant.
		if not StudioMessageFilteredCache[message] then
			StudioMessageFilteredCache[message] = true
			wait()
		end
		return message
	end

	return nil
end


Prompt: -- LOCAL

Response:
local players = game:GetService("Players")
local runService = game:GetService("RunService")
local heartbeat = runService.Heartbeat
local localPlayer = runService:IsClient() and players.LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local httpService = game:GetService("HttpService")
local Enum_ = require(script.Enum)
local enum = Enum_.enums
local Janitor = require(script.Janitor)
local Signal = require(script.Signal)
local ZonePlusReference = require(script.ZonePlusReference)
local referenceObject = ZonePlusReference.getObject()
local zoneControllerModule = script.ZoneController
local trackerModule = zoneControllerModule.Tracker
local collectiveWorldModelModule = zoneControllerModule.CollectiveWorldModel
local ZoneController = require(zoneControllerModule)
local referenceLocation = (game:GetService("RunService"):IsClient() and "Client") or "Server"
local referencePresent = referenceObject and referenceObject:FindFirstChild(referenceLocation)
if referencePresent then
	return require(referenceObject.Value)
end

local Zone = {}
Zone.__index = Zone
if not referencePresent then
	ZonePlusReference.addToReplicatedStorage()
end
Zone.enum = enum


Prompt: -- PopperCam mod

Response:
local Poppercam = require(popperCamModule)
local ZoomController = require(cameraModule:WaitForChild("ZoomController"))

function Poppercam:Update(renderDt, desiredCameraCFrame, desiredCameraFocus, cameraController)
	local rotatedFocus = desiredCameraFocus * (desiredCameraCFrame - desiredCameraCFrame.p)
	local extrapolation = self.focusExtrapolator:Step(renderDt, rotatedFocus)
	local zoom = ZoomController.Update(renderDt, rotatedFocus, extrapolation)
	return rotatedFocus*CFrame.new(0, 0, zoom), desiredCameraFocus
end


Prompt:
--[[
	A special key for property tables, which parents any given descendants into
	an instance.
]]

Response:
local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local logWarn = require(Package.Logging.logWarn)
local Observer = require(Package.State.Observer)
local xtypeof = require(Package.Utility.xtypeof)

type Set<T> = {[T]: boolean}


Prompt:
--[[
	A 'Symbol' is an opaque marker type.

	Symbols have the type 'userdata', but when printed to the console, the name
	of the symbol is shown.
]]

Response: local Symbol = {}


Prompt: -- Frame that contains the selection

Response:
local SelectionFrame = InteractionGui:WaitForChild("SelectionFrame")
local TopBar = PlayerGui:WaitForChild("TopBar")


Prompt: -- Decompiled with the Synapse X Luau decompiler.

Response:
return {
	["Fantasy Coins"] = {
		canDrop = true,
		dropWeight = 40,
		isUnique = false,
		tiers = { {
				title = "Fantasy Coins I",
				desc = "Pet earns +15% more Fantasy Coins",
				value = 1.15
			}, {
				title = "Fantasy Coins II",
				desc = "Pet earns +30% more Fantasy Coins",
				value = 1.3
			}, {
				title = "Fantasy Coins III",
				desc = "Pet earns +50% more Fantasy Coins",
				value = 1.5
			}, {
				title = "Fantasy Coins IV",
				desc = "Pet earns +75% more Fantasy Coins",
				value = 1.75
			}, {
				title = "Fantasy Coins V",
				desc = "Pet earns +100% more Fantasy Coins",
				value = 2
			} }
	}
};


Prompt:
--[=[
	Add a task to clean up. Tasks given to a maid will be cleaned when
	maid[index] is set to a different value.

	Task cleanup is such that if the task is an event, it is disconnected.
	If it is an object, it is destroyed.

	```
	Maid[key] = (function)         Adds a task to perform
	Maid[key] = (event connection) Manages an event connection
	Maid[key] = (thread)           Manages a thread
	Maid[key] = (Maid)             Maids can act as an event connection, allowing a Maid to have other maids to clean up.
	Maid[key] = (Object)           Maids can cleanup objects with a `Destroy` method
	Maid[key] = nil                Removes a named task.
	```

	@param index any
	@param newTask MaidTask
]=]

Response:
function Maid:__newindex(index, newTask)
	if Maid[index] ~= nil then
		error(("Cannot use '%s' as a Maid key"):format(tostring(index)), 2)
	end

	local tasks = self._tasks
	local oldTask = tasks[index]

	if oldTask == newTask then
		return
	end

	tasks[index] = newTask

	if oldTask then
		if type(oldTask) == "function" then
			oldTask()
		elseif type(oldTask) == "thread" then
			local cancelled
			if coroutine.running() ~= oldTask then
				cancelled = pcall(function()
					task.cancel(oldTask)
				end)
			end

			if not cancelled then
				task.defer(function()
					task.cancel(oldTask)
				end)
			end
		elseif typeof(oldTask) == "RBXScriptConnection" then
			oldTask:Disconnect()
		elseif oldTask.Destroy then
			oldTask:Destroy()
		end
	end
end


Prompt:
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data

Response:
return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	return plrData.Character.Stats.Days.Value < 1
end


Prompt: -- Properties

Response:
local Map = {}
local Groups = {}
local EmptySound = Instance.new("Sound")


Prompt:
--[[

	CameraShakePresets.Bump
	CameraShakePresets.Explosion
	CameraShakePresets.Earthquake
	CameraShakePresets.BadTrip
	CameraShakePresets.HandheldCamera
	CameraShakePresets.Vibration
	CameraShakePresets.RoughDriving

--]]

Response:
local CameraShakeInstance = require(script.Parent.CameraShakeInstance)

local CameraShakePresets = {

	-- A high-magnitude, short, yet smooth shake.
	-- Should happen once.
	Bump = function()
		local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
		c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;

	-- A high-magnitude, short, yet smooth shake.
	-- Should happen once.
	Knocked = function()
		local c = CameraShakeInstance.new(2.5, 8, 0.05, 0.75)
		c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;

	-- An intense and rough shake.
	-- Should happen once.
	Explosion = function()
		local c = CameraShakeInstance.new(5, 10, 0, 1.5)
		c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
		c.RotationInfluence = Vector3.new(4, 1, 1)
		return c
	end;

	-- A continuous, rough shake
	-- Sustained.
	Earthquake = function()
		local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
		c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
		c.RotationInfluence = Vector3.new(1, 1, 4)
		return c
	end;

	-- A bizarre shake with a very high magnitude and low roughness.
	-- Sustained.
	BadTrip = function()
		local c = CameraShakeInstance.new(10, 0.15, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0.15)
		c.RotationInfluence = Vector3.new(2, 1, 4)
		return c
	end;

	-- A subtle, slow shake.
	-- Sustained.
	HandheldCamera = function()
		local c = CameraShakeInstance.new(1, 0.25, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
		return c
	end;

	-- A very rough, yet low magnitude shake.
	-- Sustained.
	Vibration = function()
		local c = CameraShakeInstance.new(0.4, 20, 2, 2)
		c.PositionInfluence = Vector3.new(0, 0.15, 0)
		c.RotationInfluence = Vector3.new(1.25, 0, 4)
		return c
	end;

	-- A slightly rough, medium magnitude shake.
	-- Sustained.
	RoughDriving = function()
		local c = CameraShakeInstance.new(1, 2, 1, 1)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;

}

return setmetatable({}, {
	__index = function(t, i)
		local f = CameraShakePresets[i]
		if (type(f) == "function") then
			return f()
		end
		error("No preset found with index \"" .. i .. "\"")
	end;
})


Prompt: -- Core events

Response:
ToolChanged = RbxUtility.CreateSignal();

function EquipTool(Tool)
	-- Equips and switches to the given tool

	-- Unequip current tool
	if CurrentTool and CurrentTool.Equipped then
		CurrentTool.Unequip();
		CurrentTool.Equipped = false;
	end;

	-- Set `Tool` as current
	CurrentTool = Tool;
	CurrentTool.Equipped = true;

	-- Fire relevant events
	ToolChanged:fire(Tool);

	-- Equip the tool
	Tool.Equip();

end;

function RecolorHandle(Color)
	SyncAPI:Invoke('RecolorHandle', Color);
end;


Prompt: --- Makes a type that contains a sequence, e.g. Vector3 or Color3

Response:
function Util.MakeSequenceType(options)
	options = options or {}

	assert(options.Parse ~= nil or options.Constructor ~= nil, "MakeSequenceType: Must provide one of: Constructor, Parse")

	options.TransformEach = options.TransformEach or function(...)
		return ...
	end

	options.ValidateEach = options.ValidateEach or function()
		return true
	end

	return {
		Prefixes = options.Prefixes;

		Transform = function (text)
			return Util.Map(Util.SplitPrioritizedDelimeter(text, {",", "%s"}), function(value)
				return options.TransformEach(value)
			end)
		end;

		Validate = function (components)
			if options.Length and #components > options.Length then
				return false, ("Maximum of %d values allowed in sequence"):format(options.Length)
			end

			for i = 1, options.Length or #components do
				local valid, reason = options.ValidateEach(components[i], i)

				if not valid then
					return false, reason
				end
			end

			return true
		end;

		Parse = options.Parse or function(components)
			return options.Constructor(unpack(components))
		end
	}
end


Prompt: -- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it.

Response:
local dayLength = 60

local cycleTime = dayLength*60
local minutesInADay = 24*60

local lighting = game:GetService("Lighting")

local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime

local timeRatio = minutesInADay / cycleTime

if dayLength == 0 then
	dayLength = 1
end

repeat
	local currentTime = tick()

	if currentTime > endTime then
		startTime = endTime
		endTime = startTime + cycleTime
	end

	lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
	wait(1/15)
until false


Prompt:
--[=[
	Destroy the ServerComm object.
]=]

Response:
function ServerComm:Destroy()
	self._instancesFolder:Destroy()
end

return ServerComm


Prompt: --Made by Stickmasterluke

Response:
sp = script.Parent

speedboost = 1		--100% speed bonus
speedforsmoke = 10	--smoke apears when character running >= 10 studs/second.

local tooltag = script:WaitForChild("ToolTag",2)

if tooltag~=nil then
	local tool=tooltag.Value
	local h=sp:FindFirstChild("Humanoid")
	if h~=nil then
		h.WalkSpeed=16+16*speedboost
		local hrp = sp:FindFirstChild("HumanoidRootPart")
		if hrp ~= nil then
			smokepart=Instance.new("Part")
			smokepart.FormFactor="Custom"
			smokepart.Size=Vector3.new(0,0,0)
			smokepart.TopSurface="Smooth"
			smokepart.BottomSurface="Smooth"
			smokepart.CanCollide=false
			smokepart.Transparency=1
			local weld=Instance.new("Weld")
			weld.Name="SmokePartWeld"
			weld.Part0 = hrp
			weld.Part1=smokepart
			weld.C0=CFrame.new(0,-3.5,0)*CFrame.Angles(math.pi/4,0,0)
			weld.Parent=smokepart
			smokepart.Parent=sp
			smoke=Instance.new("Smoke")
			smoke.Enabled = hrp.Velocity.magnitude>speedforsmoke
			smoke.RiseVelocity=2
			smoke.Opacity=.25
			smoke.Size=.5
			smoke.Parent=smokepart
			h.Running:connect(function(speed)
				if smoke and smoke~=nil then
					smoke.Enabled=speed>speedforsmoke
				end
			end)
		end
	end
	while tool~=nil and tool.Parent==sp and h~=nil do
		sp.ChildRemoved:wait()
	end
	local h=sp:FindFirstChild("Humanoid")
	if h~=nil then
		h.WalkSpeed=16
	end
end

if smokepart~=nil then
	smokepart:Destroy()
end
script:Destroy()


Prompt: --// Above was taken directly from Util.GetStringTextBounds() in the old chat corescripts.

Response:
function methods:GetMessageHeight(BaseMessage, BaseFrame, xSize)
	xSize = xSize or BaseFrame.AbsoluteSize.X
	local textBoundsSize = self:GetStringTextBounds(BaseMessage.Text, BaseMessage.Font, BaseMessage.TextSize, Vector2.new(xSize, 1000))
	return textBoundsSize.Y
end

function methods:GetNumberOfSpaces(str, font, textSize)
	local strSize = self:GetStringTextBounds(str, font, textSize)
	local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize)
	return math.ceil(strSize.X / singleSpaceSize.X)
end

function methods:CreateBaseMessage(message, font, textSize, chatColor)
	local BaseFrame = self:GetFromObjectPool("Frame")
	BaseFrame.Selectable = false
	BaseFrame.Size = UDim2.new(1, 0, 0, 18)
	BaseFrame.Visible = true
	BaseFrame.BackgroundTransparency = 1

	local messageBorder = 8

	local BaseMessage = self:GetFromObjectPool("TextLabel")
	BaseMessage.Selectable = false
	BaseMessage.Size = UDim2.new(1, -(messageBorder + 6), 1, 0)
	BaseMessage.Position = UDim2.new(0, messageBorder, 0, 0)
	BaseMessage.BackgroundTransparency = 1
	BaseMessage.Font = font
	BaseMessage.TextSize = textSize
	BaseMessage.TextXAlignment = Enum.TextXAlignment.Left
	BaseMessage.TextYAlignment = Enum.TextYAlignment.Top
	BaseMessage.TextTransparency = 0
	BaseMessage.TextStrokeTransparency = 0.75
	BaseMessage.TextColor3 = chatColor
	BaseMessage.TextWrapped = true
	BaseMessage.Text = message
	BaseMessage.Visible = true
	BaseMessage.Parent = BaseFrame

	return BaseFrame, BaseMessage
end

function methods:AddNameButtonToBaseMessage(BaseMessage, nameColor, formatName, playerName)
	local speakerNameSize = self:GetStringTextBounds(formatName, BaseMessage.Font, BaseMessage.TextSize)
	local NameButton = self:GetFromObjectPool("TextButton")
	NameButton.Selectable = false
	NameButton.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y)
	NameButton.Position = UDim2.new(0, 0, 0, 0)
	NameButton.BackgroundTransparency = 1
	NameButton.Font = BaseMessage.Font
	NameButton.TextSize = BaseMessage.TextSize
	NameButton.TextXAlignment = BaseMessage.TextXAlignment
	NameButton.TextYAlignment = BaseMessage.TextYAlignment
	NameButton.TextTransparency = BaseMessage.TextTransparency
	NameButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
	NameButton.TextColor3 = nameColor
	NameButton.Text = formatName
	NameButton.Visible = true
	NameButton.Parent = BaseMessage

	local clickedConn = NameButton.MouseButton1Click:connect(function()
		self:NameButtonClicked(NameButton, playerName)
	end)

	local changedConn = nil
	changedConn = NameButton.Changed:connect(function(prop)
		if prop == "Parent" then
			clickedConn:Disconnect()
			changedConn:Disconnect()
		end
	end)

	return NameButton
end

function methods:AddChannelButtonToBaseMessage(BaseMessage, channelColor, formatChannelName, channelName)
	local channelNameSize = self:GetStringTextBounds(formatChannelName, BaseMessage.Font, BaseMessage.TextSize)
	local ChannelButton = self:GetFromObjectPool("TextButton")
	ChannelButton.Selectable = false
	ChannelButton.Size = UDim2.new(0, channelNameSize.X, 0, channelNameSize.Y)
	ChannelButton.Position = UDim2.new(0, 0, 0, 0)
	ChannelButton.BackgroundTransparency = 1
	ChannelButton.Font = BaseMessage.Font
	ChannelButton.TextSize = BaseMessage.TextSize
	ChannelButton.TextXAlignment = BaseMessage.TextXAlignment
	ChannelButton.TextYAlignment = BaseMessage.TextYAlignment
	ChannelButton.TextTransparency = BaseMessage.TextTransparency
	ChannelButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
	ChannelButton.TextColor3 = channelColor
	ChannelButton.Text = formatChannelName
	ChannelButton.Visible = true
	ChannelButton.Parent = BaseMessage

	local clickedConn = ChannelButton.MouseButton1Click:connect(function()
		self:ChannelButtonClicked(ChannelButton, channelName)
	end)

	local changedConn = nil
 	changedConn = ChannelButton.Changed:connect(function(prop)
		if prop == "Parent" then
			clickedConn:Disconnect()
			changedConn:Disconnect()
		end
	end)

	return ChannelButton
end

function GetWhisperChannelPrefix()
	if ChatConstants.WhisperChannelPrefix then
		return ChatConstants.WhisperChannelPrefix
	end
	return "To "
end

function methods:NameButtonClicked(nameButton, playerName)
	if not self.ChatWindow then
		return
	end

	if ChatSettings.ClickOnPlayerNameToWhisper then
		local player = Players:FindFirstChild(playerName)
		if player and player ~= LocalPlayer then
			local whisperChannel = GetWhisperChannelPrefix() ..playerName
			if self.ChatWindow:GetChannel(whisperChannel) then
				self.ChatBar:ResetCustomState()
				local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
				if targetChannelName ~= whisperChannel then
					self.ChatWindow:SwitchCurrentChannel(whisperChannel)
				end
				self.ChatBar:ResetText()
				self.ChatBar:CaptureFocus()
			elseif not self.ChatBar:IsInCustomState() then
				local whisperMessage = "/w " ..playerName
				self.ChatBar:CaptureFocus()
				self.ChatBar:SetText(whisperMessage)
			end
		end
	end
end

function methods:ChannelButtonClicked(channelButton, channelName)
	if not self.ChatWindow then
		return
	end

	if ChatSettings.ClickOnChannelNameToSetMainChannel then
		if self.ChatWindow:GetChannel(channelName) then
			self.ChatBar:ResetCustomState()
			local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
			if targetChannelName ~= channelName then
				self.ChatWindow:SwitchCurrentChannel(channelName)
			end
			self.ChatBar:ResetText()
			self.ChatBar:CaptureFocus()
		end
	end
end

function methods:RegisterChatWindow(chatWindow)
	self.ChatWindow = chatWindow
	self.ChatBar = chatWindow:GetChatBar()
end

function methods:GetFromObjectPool(className)
	if self.ObjectPool == nil then
		return Instance.new(className)
	end
	return self.ObjectPool:GetInstance(className)
end

function methods:RegisterObjectPool(objectPool)
	self.ObjectPool = objectPool
end


Prompt: -- Create AdminTools if it doesn't exist

Response:
if not AdminTools then
	AdminTools = Instance.new('Model')
	AdminTools.Name = 'AdminTools'

	-- Load all of the assets in ToolAssetsToLoad and put them in AdminTools
	for _, intObject in pairs(ToolAssetsToLoad:GetChildren()) do
		if intObject and intObject:IsA('IntValue') and intObject.Value then
			local assetModel = InsertService:LoadAsset(intObject.Value)
			if assetModel then
				local asset = assetModel:GetChildren()[1]
				if asset then
					asset.Parent = AdminTools
				end
			end
		end
	end

	AdminTools.Parent = LightingService
end

PlayersService.PlayerAdded:connect(OnPlayerAdded)


Prompt: -- / ga / --

Response:
local ga = game.ServerStorage.GA
local models = ga.Models


Prompt: -- Alias function to automatically error out for invalid types.

Response:
local function MandateType(value, type, paramName, nullable)
	if nullable and value == nil then return end
	assert(typeof(value) == type, ERR_INVALID_TYPE:format(paramName or "ERR_NO_PARAM_NAME", type, typeof(value)))
end


Prompt: -- Decompiled with the Synapse X Luau decompiler.

Response:
local v1 = {
	type = function(p1)
		return function(p2)
			local v2 = type(p2);
			if v2 == p1 then
				return true;
			end;
			return false, string.format("%s expected, got %s", p1, v2);
		end;
	end,
	typeof = function(p3)
		return function(p4)
			local v3 = typeof(p4);
			if v3 == p3 then
				return true;
			end;
			return false, string.format("%s expected, got %s", p3, v3);
		end;
	end,
	any = function(p5)
		if p5 ~= nil then
			return true;
		end;
		return false, "any expected, got nil";
	end
};
v1.boolean = v1.typeof("boolean");
v1.thread = v1.typeof("thread");
v1.callback = v1.typeof("function");
v1["function"] = v1.callback;
v1.none = v1.typeof("nil");
v1.nil = v1.none;
v1.string = v1.typeof("string");
v1.table = v1.typeof("table");
v1.userdata = v1.type("userdata");
function v1.number(p6)
	local v4 = typeof(p6);
	if v4 ~= "number" then
		return false, string.format("number expected, got %s", v4);
	end;
	if p6 == p6 then
		return true;
	end;
	return false, "unexpected NaN value";
end;
function v1.nan(p7)
	local v5 = typeof(p7);
	if v5 ~= "number" then
		return false, string.format("number expected, got %s", v5);
	end;
	if p7 ~= p7 then
		return true;
	end;
	return false, "unexpected non-NaN value";
end;
v1.Axes = v1.typeof("Axes");
v1.BrickColor = v1.typeof("BrickColor");
v1.CatalogSearchParams = v1.typeof("CatalogSearchParams");
v1.CFrame = v1.typeof("CFrame");
v1.Color3 = v1.typeof("Color3");
v1.ColorSequence = v1.typeof("ColorSequence");
v1.ColorSequenceKeypoint = v1.typeof("ColorSequenceKeypoint");
v1.DateTime = v1.typeof("DateTime");
v1.DockWidgetPluginGuiInfo = v1.typeof("DockWidgetPluginGuiInfo");
v1.Enum = v1.typeof("Enum");
v1.EnumItem = v1.typeof("EnumItem");
v1.Enums = v1.typeof("Enums");
v1.Faces = v1.typeof("Faces");
v1.Instance = v1.typeof("Instance");
v1.NumberRange = v1.typeof("NumberRange");
v1.NumberSequence = v1.typeof("NumberSequence");
v1.NumberSequenceKeypoint = v1.typeof("NumberSequenceKeypoint");
v1.PathWaypoint = v1.typeof("PathWaypoint");
v1.PhysicalProperties = v1.typeof("PhysicalProperties");
v1.Random = v1.typeof("Random");
v1.Ray = v1.typeof("Ray");
v1.RaycastParams = v1.typeof("RaycastParams");
v1.RaycastResult = v1.typeof("RaycastResult");
v1.RBXScriptConnection = v1.typeof("RBXScriptConnection");
v1.RBXScriptSignal = v1.typeof("RBXScriptSignal");
v1.Rect = v1.typeof("Rect");
v1.Region3 = v1.typeof("Region3");
v1.Region3int16 = v1.typeof("Region3int16");
v1.TweenInfo = v1.typeof("TweenInfo");
v1.UDim = v1.typeof("UDim");
v1.UDim2 = v1.typeof("UDim2");
v1.Vector2 = v1.typeof("Vector2");
v1.Vector2int16 = v1.typeof("Vector2int16");
v1.Vector3 = v1.typeof("Vector3");
v1.Vector3int16 = v1.typeof("Vector3int16");
function v1.literal(...)
	local v6 = select("#", ...);
	if v6 == 1 then
		local u1 = ...;
		return function(p8)
			if p8 == u1 then
				return true;
			end;
			return false, string.format("expected %s, got %s", tostring(u1), tostring(p8));
		end;
	end;
	local v7 = {};
	for v8 = 1, v6 do
		v7[v8] = v1.literal((select(v8, ...)));
	end;
	return v1.union(table.unpack(v7, 1, v6));
end;
v1.exactly = v1.literal;
function v1.keyOf(p9)
	local v9 = {};
	local v10 = 0;
	for v11 in pairs(p9) do
		v10 = v10 + 1;
		v9[v10] = v11;
	end;
	return v1.literal(table.unpack(v9, 1, v10));
end;
function v1.valueOf(p10)
	local v12 = {};
	local v13 = 0;
	for v14, v15 in pairs(p10) do
		v13 = v13 + 1;
		v12[v13] = v15;
	end;
	return v1.literal(table.unpack(v12, 1, v13));
end;
function v1.integer(p11)
	local v16, v17 = v1.number(p11);
	if not v16 then
		return false, v17 and "";
	end;
	if p11 % 1 == 0 then
		return true;
	end;
	return false, string.format("integer expected, got %s", p11);
end;
function v1.numberMin(p12)
	return function(p13)
		local v18, v19 = v1.number(p13);
		if not v18 then
			return false, v19 and "";
		end;
		if p12 <= p13 then
			return true;
		end;
		return false, string.format("number >= %s expected, got %s", p12, p13);
	end;
end;
function v1.numberMax(p14)
	return function(p15)
		local v20, v21 = v1.number(p15);
		if not v20 then
			return false, v21;
		end;
		if p15 <= p14 then
			return true;
		end;
		return false, string.format("number <= %s expected, got %s", p14, p15);
	end;
end;
function v1.numberMinExclusive(p16)
	return function(p17)
		local v22, v23 = v1.number(p17);
		if not v22 then
			return false, v23 and "";
		end;
		if p16 < p17 then
			return true;
		end;
		return false, string.format("number > %s expected, got %s", p16, p17);
	end;
end;
function v1.numberMaxExclusive(p18)
	return function(p19)
		local v24, v25 = v1.number(p19);
		if not v24 then
			return false, v25 and "";
		end;
		if p19 < p18 then
			return true;
		end;
		return false, string.format("number < %s expected, got %s", p18, p19);
	end;
end;
v1.numberPositive = v1.numberMinExclusive(0);
v1.numberNegative = v1.numberMaxExclusive(0);
function v1.numberConstrained(p20, p21)
	assert(v1.number(p20));
	assert(v1.number(p21));
	local u2 = v1.numberMin(p20);
	local u3 = v1.numberMax(p21);
	return function(p22)
		local v26, v27 = u2(p22);
		if not v26 then
			return false, v27 and "";
		end;
		local v28, v29 = u3(p22);
		if v28 then
			return true;
		end;
		return false, v29 and "";
	end;
end;
function v1.numberConstrainedExclusive(p23, p24)
	assert(v1.number(p23));
	assert(v1.number(p24));
	local u4 = v1.numberMinExclusive(p23);
	local u5 = v1.numberMaxExclusive(p24);
	return function(p25)
		local v30, v31 = u4(p25);
		if not v30 then
			return false, v31 and "";
		end;
		local v32, v33 = u5(p25);
		if v32 then
			return true;
		end;
		return false, v33 and "";
	end;
end;
function v1.match(p26)
	assert(v1.string(p26));
	return function(p27)
		local v34, v35 = v1.string(p27);
		if not v34 then
			return false, v35;
		end;
		if string.match(p27, p26) ~= nil then
			return true;
		end;
		return false, string.format("%q failed to match pattern %q", p27, p26);
	end;
end;
function v1.optional(p28)
	assert(v1.callback(p28));
	return function(p29)
		if p29 == nil then
			return true;
		end;
		local v36, v37 = p28(p29);
		if v36 then
			return true;
		end;
		return false, string.format("(optional) %s", v37 and "");
	end;
end;
function v1.tuple(...)
	local u6 = { ... };
	return function(...)
		local v38 = { ... };
		local v39, v40, v41 = ipairs(u6);
		while true do
			v39(v40, v41);
			if not v39 then
				break;
			end;
			v41 = v39;
			local v42, v43 = v40(v38[v39]);
			if v42 == false then
				return false, string.format("Bad tuple index #%s:\n\t%s", v39, v43 and "");
			end;
		end;
		return true;
	end;
end;
function v1.keys(p30)
	assert(v1.callback(p30));
	return function(p31)
		local v44, v45 = v1.table(p31);
		if v44 == false then
			return false, v45 and "";
		end;
		for v46 in pairs(p31) do
			local v47, v48 = p30(v46);
			if v47 == false then
				return false, string.format("bad key %s:\n\t%s", tostring(v46), v48 and "");
			end;
		end;
		return true;
	end;
end;
function v1.values(p32)
	assert(v1.callback(p32));
	return function(p33)
		local v49, v50 = v1.table(p33);
		if v49 == false then
			return false, v50 and "";
		end;
		for v51, v52 in pairs(p33) do
			local v53, v54 = p32(v52);
			if v53 == false then
				return false, string.format("bad value for key %s:\n\t%s", tostring(v51), v54 and "");
			end;
		end;
		return true;
	end;
end;
function v1.map(p34, p35)
	assert(v1.callback(p34));
	assert(v1.callback(p35));
	local u7 = v1.keys(p34);
	local u8 = v1.values(p35);
	return function(p36)
		local v55, v56 = u7(p36);
		if not v55 then
			return false, v56 and "";
		end;
		local v57, v58 = u8(p36);
		if v57 then
			return true;
		end;
		return false, v58 and "";
	end;
end;
function v1.set(p37)
	return v1.map(p37, v1.literal(true));
end;
local u9 = v1.keys(v1.integer);
function v1.array(p38)
	assert(v1.callback(p38));
	local u10 = v1.values(p38);
	return function(p39)
		local v59, v60 = u9(p39);
		if v59 == false then
			return false, string.format("[array] %s", v60 and "");
		end;
		local v61 = 0;
		local v62, v63, v64 = ipairs(p39);
		while true do
			v62(v63, v64);
			if not v62 then
				break;
			end;
			v64 = v62;
			v61 = v61 + 1;
		end;
		for v65 in pairs(p39) do
			if v65 < 1 then
				return false, string.format("[array] key %s must be sequential", tostring(v65));
			end;
			if v61 < v65 then
				return false, string.format("[array] key %s must be sequential", tostring(v65));
			end;
		end;
		local v66, v67 = u10(p39);
		if v66 then
			return true;
		end;
		return false, string.format("[array] %s", v67 and "");
	end;
end;
function v1.strictArray(...)
	local v68 = { ... };
	assert(v1.array(v1.callback)(v68));
	return function(p40)
		local v69, v70 = u9(p40);
		if v69 == false then
			return false, string.format("[strictArray] %s", v70 and "");
		end;
		if #v68 < #p40 then
			return false, string.format("[strictArray] Array size exceeds limit of %d", #v68);
		end;
		for v71, v72 in pairs(v68) do
			local v73, v74 = v72(p40[v71]);
			if not v73 then
				return false, string.format("[strictArray] Array index #%d - %s", v71, v74);
			end;
		end;
		return true;
	end;
end;
u9 = v1.array;
u9 = u9(v1.callback);
function v1.union(...)
	local v75 = { ... };
	assert(u9(v75));
	return function(p41)
		local v76, v77, v78 = ipairs(v75);
		while true do
			v76(v77, v78);
			if not v76 then
				break;
			end;
			v78 = v76;
			if v77(p41) then
				return true;
			end;
		end;
		return false, "bad type for union";
	end;
end;
v1.some = v1.union;
function v1.intersection(...)
	local v79 = { ... };
	assert(u9(v79));
	return function(p42)
		local v80, v81, v82 = ipairs(v79);
		while true do
			v80(v81, v82);
			if not v80 then
				break;
			end;
			v82 = v80;
			local v83, v84 = v81(p42);
			if not v83 then
				return false, v84 and "";
			end;
		end;
		return true;
	end;
end;
v1.every = v1.intersection;
u9 = v1.map;
u9 = u9(v1.any, v1.callback);
function v1.interface(p43)
	assert(u9(p43));
	return function(p44)
		local v85, v86 = v1.table(p44);
		if v85 == false then
			return false, v86 and "";
		end;
		for v87, v88 in pairs(p43) do
			local v89, v90 = v88(p44[v87]);
			if v89 == false then
				return false, string.format("[interface] bad value for %s:\n\t%s", tostring(v87), v90 and "");
			end;
		end;
		return true;
	end;
end;
function v1.strictInterface(p45)
	assert(u9(p45));
	return function(p46)
		local v91, v92 = v1.table(p46);
		if v91 == false then
			return false, v92 and "";
		end;
		for v93, v94 in pairs(p45) do
			local v95, v96 = v94(p46[v93]);
			if v95 == false then
				return false, string.format("[interface] bad value for %s:\n\t%s", tostring(v93), v96 and "");
			end;
		end;
		for v97 in pairs(p46) do
			if not p45[v97] then
				return false, string.format("[interface] unexpected field %q", tostring(v97));
			end;
		end;
		return true;
	end;
end;
u9 = function(p47, p48)
	assert(v1.string(p47));
	local v98 = nil;
	if p48 ~= nil then
		v98 = v1.children(p48);
	end;
	return function(p49)
		local v99, v100 = v1.Instance(p49);
		if not v99 then
			return false, v100 and "";
		end;
		if p49.ClassName ~= p47 then
			return false, string.format("%s expected, got %s", p47, p49.ClassName);
		end;
		if v98 then
			local v101, v102 = v98(p49);
			if not v101 then
				return false, v102;
			end;
		end;
		return true;
	end;
end;
v1.instanceOf = u9;
u9 = v1.instanceOf;
v1.instance = u9;
u9 = function(p50, p51)
	assert(v1.string(p50));
	local v103 = nil;
	if p51 ~= nil then
		v103 = v1.children(p51);
	end;
	return function(p52)
		local v104, v105 = v1.Instance(p52);
		if not v104 then
			return false, v105 and "";
		end;
		if not p52:IsA(p50) then
			return false, string.format("%s expected, got %s", p50, p52.ClassName);
		end;
		if v103 then
			local v106, v107 = v103(p52);
			if not v106 then
				return false, v107;
			end;
		end;
		return true;
	end;
end;
v1.instanceIsA = u9;
u9 = function(p53)
	assert(v1.Enum(p53));
	return function(p54)
		local v108, v109 = v1.EnumItem(p54);
		if not v108 then
			return false, v109;
		end;
		if p54.EnumType == p53 then
			return true;
		end;
		return false, string.format("enum of %s expected, got enum of %s", tostring(p53), tostring(p54.EnumType));
	end;
end;
v1.enum = u9;
u9 = v1.tuple;
u9 = u9(v1.callback, v1.callback);
function v1.wrap(p55, p56)
	assert(u9(p55, p56));
	return function(...)
		assert(p56(...));
		return p55(...);
	end;
end;
u9 = function(p57)
	return function(...)
		assert(p57(...));
	end;
end;
v1.strict = u9;
u9 = v1.map;
u9 = u9(v1.string, v1.callback);
function v1.children(p58)
	assert(u9(p58));
	return function(p59)
		local v110, v111 = v1.Instance(p59);
		if not v110 then
			return false, v111 and "";
		end;
		local v112 = {};
		local v113, v114, v115 = ipairs(p59:GetChildren());
		while true do
			v113(v114, v115);
			if not v113 then
				break;
			end;
			v115 = v113;
			local l__Name__116 = v114.Name;
			if p58[l__Name__116] then
				if v112[l__Name__116] then
					return false, string.format("Cannot process multiple children with the same name %q", l__Name__116);
				end;
				v112[l__Name__116] = v114;
			end;
		end;
		for v117, v118 in pairs(p58) do
			local v119, v120 = v118(v112[v117]);
			if not v119 then
				return false, string.format("[%s.%s] %s", p59:GetFullName(), v117, v120 and "");
			end;
		end;
		return true;
	end;
end;
return v1;


Prompt: -- Stores useful information about Luau errors.

Response:
export type Error = {
	type: string, -- replace with "Error" when Luau supports singleton types
	raw: string,
	message: string,
	trace: string
}


Prompt: -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote

Response:
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}

local PreloadAnimsUserFlag = false
local PreloadedAnims = {}
local successPreloadAnim, msgPreloadAnim = pcall(function()
	PreloadAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserPreloadAnimations")
end)
if not successPreloadAnim then
	PreloadAnimsUserFlag = false
end

math.randomseed(tick())

function findExistingAnimationInSet(set, anim)
	if set == nil or anim == nil then
		return 0
	end

	for idx = 1, set.count, 1 do
		if set[idx].anim.AnimationId == anim.AnimationId then
			return idx
		end
	end

	return 0
end

function configureAnimationSet(name, fileList)
	if (animTable[name] ~= nil) then
		for _, connection in pairs(animTable[name].connections) do
			connection:disconnect()
		end
	end
	animTable[name] = {}
	animTable[name].count = 0
	animTable[name].totalWeight = 0
	animTable[name].connections = {}

	local allowCustomAnimations = true
	local AllowDisableCustomAnimsUserFlag = false

	local success, msg = pcall(function()
		AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
	end)

	if (AllowDisableCustomAnimsUserFlag) then
		local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
		if not success then
			allowCustomAnimations = true
		end
	end

	-- check for config values
	local config = script:FindFirstChild(name)
	if (allowCustomAnimations and config ~= nil) then
		table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
		table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))

		local idx = 0
		for _, childPart in pairs(config:GetChildren()) do
			if (childPart:IsA("Animation")) then
				local newWeight = 1
				local weightObject = childPart:FindFirstChild("Weight")
				if (weightObject ~= nil) then
					newWeight = weightObject.Value
				end
				animTable[name].count = animTable[name].count + 1
				idx = animTable[name].count
				animTable[name][idx] = {}
				animTable[name][idx].anim = childPart
				animTable[name][idx].weight = newWeight
				animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
				table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
				table.insert(animTable[name].connections, childPart.ChildAdded:connect(function(property) configureAnimationSet(name, fileList) end))
				table.insert(animTable[name].connections, childPart.ChildRemoved:connect(function(property) configureAnimationSet(name, fileList) end))
			end
		end
	end

	-- fallback to defaults
	if (animTable[name].count <= 0) then
		for idx, anim in pairs(fileList) do
			animTable[name][idx] = {}
			animTable[name][idx].anim = Instance.new("Animation")
			animTable[name][idx].anim.Name = name
			animTable[name][idx].anim.AnimationId = anim.id
			animTable[name][idx].weight = anim.weight
			animTable[name].count = animTable[name].count + 1
			animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
		end
	end

	-- preload anims
	if PreloadAnimsUserFlag then
		for i, animType in pairs(animTable) do
			for idx = 1, animType.count, 1 do
				if PreloadedAnims[animType[idx].anim.AnimationId] == nil then
					Humanoid:LoadAnimation(animType[idx].anim)
					PreloadedAnims[animType[idx].anim.AnimationId] = true
				end
			end
		end
	end
end


Prompt:
--to do
--go towards boxes
--account for arrows and paladins
--account for boss size

Response:
local MoveDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5)}
local GasDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5),Vector3.new(5,0,5),Vector3.new(-5,0,5),Vector3.new(5,0,-5),Vector3.new(-5,0,-5)}

return function(Map)
	local Pathfinding = require(game.ReplicatedStorage.PathfindFunctions)(Map)
	local Movement = require(game.ReplicatedStorage.EnemyAi.Movement)(Map)
	local Self = {}
	local ExploredPositions = {}
	local OutsidePositions = {}

	Self.CheckSquare = function(Position)
		if table.find(Map,Vector3.new(Position.X, 0, Position.Z)) then
			return true
		end
		return false
	end

	Self.GetDangerSpots = function(Enemies)
		local Spots = {}
		for i, Enemy in pairs (Enemies) do
			if Enemy.IsAttacking then
				for i, v in pairs(MoveDirections) do
					table.insert(Spots, Enemy.Position - Vector3.new(0, Enemy.Position.Y) + v)
				end
			end
		end
		for i, Projectile in pairs(workspace.ActiveProjectiles:GetChildren()) do
			local NewPos = Projectile.PrimaryPart.Position + Projectile.MoveDirection.Value
			local FlooredSpot = Vector3.new(math.floor(NewPos.X/5)*5, 0,math.floor(NewPos.Z/5)*5)
			table.insert(Spots, FlooredSpot)

		end
		for i, Trap in pairs(workspace.ActiveTraps:GetChildren()) do
			table.insert(Spots, Trap.PrimaryPart.Position)
			if Trap.PrimaryPart.Size.X >= 12 then
				for i, v in pairs(GasDirections) do
					table.insert(Spots, Trap.PrimaryPart.Position + v)
				end
			end
		end
		return Spots
	end

	Self.GetAttackersOfSpot = function(Position)
		local Attackers = {}
		for i, Model in pairs(workspace.ActiveEnemies:GetChildren()) do
			if (Model.PrimaryPart.Position - Position).Magnitude <= 7 then
				table.insert(Attackers, Model)
			end
		end
		return Attackers
	end

	Self.GetEnemies = function()
		local EnemyTable = {}
		for i ,v in pairs(workspace.ActiveEnemies:GetChildren()) do
			local SpotData = {}
			SpotData.Position = v.PrimaryPart.Position
			SpotData.IsAttacking = v.PrimaryPart.BrickColor == BrickColor.new("Really red")
			table.insert(EnemyTable, SpotData)
		end
		return EnemyTable
	end

	Self.GetEnemyAtPosition = function(Position, EnemyTable)
		for i, v in pairs(EnemyTable) do
			if Vector3.new(v.Position.X, 0, v.Position.Z) == Vector3.new(Position.X, 0, Position.Z) then
				return v
			end
		end
		return false
	end

	Self.CheckIfDangerSpot = function(Position, DangerSpots)
		for i, v in pairs(DangerSpots) do
			if Vector3.new(v.X, 0, v.Z) == Vector3.new(Position.X, 0, Position.Z) then
				return v
			end
		end
		return false
	end

	Self.GetBestCostingSpot = function(Spots)
		local BestCost = -math.huge
		local BestSpots = {}
		for i, v in pairs(Spots) do
			if v.Cost > BestCost then
				BestCost = v.Cost
				BestSpots = {}
				table.insert(BestSpots, v)
			elseif v.Cost == BestCost then
				table.insert(BestSpots, v)
			end

		end
		return BestSpots[math.random(1, #BestSpots)]
	end

	Self.PositionReachedAmount = function(Position)
		local Amount = 0
		for i, v in pairs(ExploredPositions) do
			if Vector3.new(v.X, 0, v.Z) == Position - Vector3.new(Position.Y) then
				Amount += 1
			end
		end
		return Amount
	end

	Self.UpdateEnemies = function(EnemyTable)
		local NewTable = {}
		for i, v in pairs(EnemyTable) do
			if v.IsAttacking then
				local MoveDirection = Movement.GetNearestPlayerDirection(v.Position, false, false, nil, true)
				local NewData = {}
				NewData.Position = v.Position + MoveDirection
				-- you could check but this is the lazy way
				NewData.IsAttacking = true
			end
		end
		return NewTable
	end

	Self.GetOutsideSquares = function()
		local Squares = {}
		for i, Spot in pairs(Map) do
			for i, v in pairs(MoveDirections) do
				if not Self.CheckSquare(Spot+v) then
					table.insert(Squares, Spot)
					break
				end
			end
		end
		OutsidePositions = Squares
	end

	Self.IsOutsideSquare = function(Position, Squares)
		if table.find(OutsidePositions, Vector3.new(Position.X,0,Position.Z)) then
			return true
		else
			return false
		end
	end

	Self.GetMoveInfo = function(EnemyTable, Depth, playerPos, SentDirections)
		local Spots = {}
		local PlayerPos = playerPos
		local DangerSpots = Self.GetDangerSpots(EnemyTable)
		local Loot = workspace.Loot:GetChildren()
		local Closestloot  = nil
		local LootPos = nil
		local ClosestLootDistance = math.huge
		if #Loot~=0 then
			for i, v in pairs(workspace.Loot:GetChildren()) do
				local Distance = (v.PrimaryPart.Position - PlayerPos).Magnitude
				if Distance < ClosestLootDistance then
					Closestloot = v
					ClosestLootDistance= Distance
				end
			end
			LootPos = Closestloot.PrimaryPart.Position
		end

		local NewPos
		for i, v in pairs(MoveDirections) do
			DangerSpots = Self.GetDangerSpots(EnemyTable)
			--PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position

			local OriginPos = PlayerPos
			local AttackDirection = OriginPos + v

			--something wrong

			NewPos = (not Self.CheckSquare(AttackDirection) or Self.GetEnemyAtPosition(AttackDirection, EnemyTable))and OriginPos or AttackDirection

			local Directions
			if SentDirections then
				Directions = SentDirections
				table.remove(Directions, 1)
			end

			local Directions = (not SentDirections and LootPos) and Pathfinding.GetDirections(PlayerPos, LootPos)

			-- could check if there are still boxes

			local IsDangerous = Self.CheckIfDangerSpot(NewPos, DangerSpots)
			local Enemy = Self.GetEnemyAtPosition(AttackDirection, EnemyTable)
			local TimesPositionReached = Self.PositionReachedAmount(NewPos)
			local HasLoot = Closestloot and (Closestloot.PrimaryPart.Position - NewPos).Magnitude<3
			local IsOutsideSquare = Self.IsOutsideSquare(NewPos)
			local IsDirectionOfCrate = Directions and Directions[1] == v

			-- make it realize that an enemy dies when it's attacked at 0 health
			-- make this account for paladins
			local AttackersOfPlayerSpot = Self.GetAttackersOfSpot(PlayerPos)
			local CanAttackThoughRed = #AttackersOfPlayerSpot== 1 and AttackersOfPlayerSpot[1].Health.Value == 1 and AttackersOfPlayerSpot[1].PrimaryPart.Position == AttackDirection + Vector3.new(0, -AttackDirection.Y + AttackersOfPlayerSpot[1].PrimaryPart.Position.Y)
			local Cost = (IsDangerous and not CanAttackThoughRed) and-10 or 0
			Cost += TimesPositionReached*-0.1
			Cost += IsOutsideSquare and -1 or 0
			Cost += (Enemy and not IsDangerous) and 2 or 0
			Cost += CanAttackThoughRed and 2 or 0
			Cost += IsDirectionOfCrate and 4 or 0
			Cost += HasLoot and 4 or 0

			if Depth>0 then
				Cost += Self.GetMoveInfo(Self.UpdateEnemies(EnemyTable), Depth-1, PlayerPos + v, Directions).Cost
			end

			local Data = {}
			Data.Direction = v
			Data.Cost = Cost
			table.insert(Spots, Data)
		end

		local BestSpot = Self.GetBestCostingSpot(Spots)

		table.insert(ExploredPositions, PlayerPos)

		return BestSpot
	end

	Self.MovePlayer = function()
		local PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position
		PlayerPos = Vector3.new(math.floor(PlayerPos.X + 0.5), 0, math.floor(PlayerPos.Z + 0.5))
		Self.GetOutsideSquares()
		local MoveInfo = Self.GetMoveInfo(Self.GetEnemies(), 0, PlayerPos)
		game.ReplicatedStorage.Events.Move:FireServer(MoveInfo.Direction.Unit)

	end

	return Self
end


Prompt: -- Format params: methodName, ctorName

Response:
local ERR_NOT_INSTANCE = "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"

function SignalStatic.new(signalName: string): Signal
	local signalObj: Signal = {
		Name = signalName,
		Connections = {},
		YieldingThreads = {}
	}
	return setmetatable(signalObj, SignalStatic)
end

local function NewConnection(sig: Signal, func: any): Connection
	local connectionObj: Connection = {
		Signal = sig,
		Delegate = func,
		Index = -1
	}
	return setmetatable(connectionObj, ConnectionStatic)
end

local function ThreadAndReportError(delegate: any, args: GenericTable, handlerName: string)
	local thread = coroutine.create(function ()
		delegate(unpack(args))
	end)
	local success, msg = coroutine.resume(thread)
	if not success then
		-- For the love of god roblox PLEASE add the ability to customize message type in output statements.
		-- This "testservice" garbage at the start of my message is annoying as all hell.
		TestService:Error(string.format("Exception thrown in your %s event handler: %s", handlerName, msg))
		TestService:Checkpoint(debug.traceback(thread))
	end
end

function SignalStatic:Connect(func)
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Connect", "Signal.new()"))
	local connection = NewConnection(self, func)
	connection.Index = #self.Connections + 1
	table.insert(self.Connections, connection.Index, connection)
	return connection
end

function SignalStatic:Fire(...)
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Fire", "Signal.new()"))
	local args = table.pack(...)
	local allCons = self.Connections
	local yieldingThreads = self.YieldingThreads
	for index = 1, #allCons do
		local connection = allCons[index]
		if connection.Delegate ~= nil then
			-- Catch case for disposed signals.
			ThreadAndReportError(connection.Delegate, args, connection.Signal.Name)
		end
	end
	for index = 1, #yieldingThreads do
		local thread = yieldingThreads[index]
		if thread ~= nil then
			coroutine.resume(thread, ...)
		end
	end
end

function SignalStatic:FireSync(...)
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("FireSync", "Signal.new()"))
	local args = table.pack(...)
	local allCons = self.Connections
	local yieldingThreads = self.YieldingThreads
	for index = 1, #allCons do
		local connection = allCons[index]
		if connection.Delegate ~= nil then
			-- Catch case for disposed signals.
			connection.Delegate(unpack(args))
		end
	end
	for index = 1, #yieldingThreads do
		local thread = yieldingThreads[index]
		if thread ~= nil then
			coroutine.resume(thread, ...)
		end
	end
end

function SignalStatic:Wait()
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Wait", "Signal.new()"))
	local args = {}
	local thread = coroutine.running()
	table.insert(self.YieldingThreads, thread)
	args = { coroutine.yield() }
	table.removeObject(self.YieldingThreads, thread)
	return unpack(args)
end

function SignalStatic:Dispose()
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Dispose", "Signal.new()"))
	local allCons = self.Connections
	for index = 1, #allCons do
		allCons[index]:Disconnect()
	end
	self.Connections = {}
	setmetatable(self, nil)
end

function ConnectionStatic:Disconnect()
	assert(getmetatable(self) == ConnectionStatic, ERR_NOT_INSTANCE:format("Disconnect", "private function NewConnection()"))
	table.remove(self.Signal.Connections, self.Index)
	self.SignalStatic = nil
	self.Delegate = nil
	self.YieldingThreads = {}
	self.Index = -1
	setmetatable(self, nil)
end

return SignalStatic


Prompt: --"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.--

Response:
local door = script.Parent
local CanOpen1 = true
local CanClose1 = false
local clearance = {
	["[SCP] Card-Omni"] = true,
	["[SCP] Card-L5"] = true,
	["[SCP] Card-L4"] = true,
	["[SCP] Card-L3"] = true,
	["[SCP] Card-L2"] = true,
	["[SCP] Card-L1"] = true
}

						--DO NOT EDIT PAST THIS LINE--
function openDoor()
	for i = 1,(door.Size.z / 0.30) do
		wait()
		door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.30)
	end
end

function closeDoor()
	for i = 1,(door.Size.z / 0.30) do
		wait()
		door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.30)
	end
end

script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
	if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
		CanOpen1 = false
		wait(0.75)
		openDoor()
		wait(1)
		CanClose1 = true
	elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
		CanClose1 = false
		wait(0.75)
		closeDoor()
		wait(1)
		CanOpen1 = true
	end
end)

script.Parent.Parent.KeycardReader2.touched:connect(function(touch)
	if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
		CanOpen1 = false
		wait(0.75)
		openDoor()
		wait(1)
		CanClose1 = true
	elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
		CanClose1 = false
		wait(0.75)
		closeDoor()
		wait(1)
		CanOpen1 = true
	end
end)


Prompt: --[[ Local Constants ]]

Response:
--
local VR_ANGLE = math.rad(15)
local VR_PANEL_SIZE = 512
local VR_ZOOM = 7
local VR_FADE_SPEED = 10 -- 1/10 second
local VR_SCREEN_EGDE_BLEND_TIME = 0.14
local VR_SEAT_OFFSET = Vector3.new(0,4,0)

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

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local Lighting = game:GetService("Lighting")


Prompt: --EDIT BELOW----------------------------------------------------------------------

Response:
settings.PianoSoundRange = 60

settings.KeyAesthetics = true

settings.PianoSounds = {
		"714321897",
		"714321981",
		"714322052",
		"714322096",
		"714322161",
		"715236879"
}


Prompt:
--[=[
	@class ClientRemoteSignal
	@client
	Created via `ClientComm:GetSignal()`.
]=]

Response:
local ClientRemoteSignal = {}
ClientRemoteSignal.__index = ClientRemoteSignal


Prompt:
--function Util.guard(...)
--	local converted = {...}
--	assert(type(converted[#converted]) == "string", "Util.Guard Requires String as Last Arg")
--	for _, condition in pairs(converted) do
--		if not condition then
--			warn(converted[#converted])
--			return
--		end
--	end
--end

Response: return Util


Prompt: --//DEFAULT VALUES

Response:
local defexposure = game.Lighting.ExposureCompensation

local nvg
local onanim
local gui
local offanim
local config
local onremoved
local setting
local helmet

function removehelmet()
	if plr.Character then
		if onremoved then
			onremoved:Disconnect()
		end
		animating = false
		togglenvg(false)
		actionservice:UnbindAction("nvgtoggle")
		if gui then
			gui:Destroy()
		end
		if helmet then
			helmet:Destroy()
		end
	end
end

function oncharadded(newchar)
	newchar:WaitForChild("Humanoid").Died:connect(function()
		removehelmet()
	end)
	newchar.ChildAdded:connect(function(child)
		local removebutton
		if child.Name == "Helmet" then
			helmet = child
			gui = Instance.new("ScreenGui")
			gui.IgnoreGuiInset = true

			removebutton = Instance.new("TextButton")
			removebutton.Text = "Helmet"
			removebutton.Size = UDim2.new(.05,0,.035,0)
			removebutton.TextColor3 = Color3.new(.75,.75,.75)
			removebutton.Position = UDim2.new(.1,0,.3,0)
			removebutton.BackgroundTransparency = 1
			removebutton.BackgroundColor3 = Color3.fromRGB(124, 52, 38)
			removebutton.Font = Enum.Font.SourceSansBold
			removebutton.TextScaled = true
			removebutton.TextTransparency = 1
			removebutton.MouseButton1Down:connect(removehelmet)

			removebutton.Parent = gui
			gui.Parent = plr.PlayerGui

			onremoved = child.AncestryChanged:Connect(function(_, parent)
				if not parent then
					removehelmet()
				end
			end)

		end
		local newnvg = child:WaitForChild("Up",.5)
		if newnvg then
			nvg = newnvg
			config = require(nvg:WaitForChild("AUTO_CONFIG"))
			setting = nvg:WaitForChild("NVG_Settings")

			local noise = Instance.new("ImageLabel")
			noise.BackgroundTransparency = 1
			noise.ImageTransparency = 1

			local overlay = noise:Clone()
			overlay.Image = "rbxassetid://"..setting.OverlayImage.Value
			overlay.Size = UDim2.new(1,0,1,0)
			overlay.Name = "Overlay"
			overlay.ZIndex = 2

			local buttonpos = setting.RemoveButtonPosition.Value
			removebutton.Position = UDim2.new(buttonpos.X,0,buttonpos.Y,0)

			noise.Name = "Noise"
			noise.AnchorPoint = Vector2.new(.5,.5)
			noise.Position = UDim2.new(.5,0,.5,0)
			noise.Size = UDim2.new(2,0,2,0)

			overlay.Parent = gui
			noise.Parent = gui

			local info = config.tweeninfo

			local function addtweens(base,extra)
				if extra then
					for _,tween in pairs(extra)do
						table.insert(base,tween)
					end
				end
			end

			onanim = config.onanim
			offanim = config.offanim

			on_overlayanim = {
				tweenservice:Create(game.Lighting,info,{ExposureCompensation = setting.Exposure.Value}),
				tweenservice:Create(colorcorrection,info,{Brightness = setting.OverlayBrightness.Value,Contrast = .8,Saturation = -1,TintColor = setting.OverlayColor.Value}),
				tweenservice:Create(gui.Overlay,info,{ImageTransparency = 0}),
				tweenservice:Create(gui.Noise,info,{ImageTransparency = 0}),
			}

			off_overlayanim = {
				tweenservice:Create(game.Lighting,info,{ExposureCompensation = defexposure}),
				tweenservice:Create(colorcorrection,info,{Brightness = 0,Contrast = 0,Saturation = 0,TintColor = Color3.fromRGB(255, 255, 255)}),
				tweenservice:Create(gui.Overlay,info,{ImageTransparency = 1}),
				tweenservice:Create(gui.Noise,info,{ImageTransparency = 1}),
			}

			actionservice:BindAction("nvgtoggle",function() togglenvg(not nvgactive) return Enum.ContextActionResult.Pass end, true, Enum.KeyCode.N)

		end
	end)
end

plr.CharacterAdded:connect(oncharadded)

local oldchar = workspace:FindFirstChild(plr.Name)
if oldchar then
	oncharadded(oldchar)
end

function playtween(tweentbl)
	spawn(function()
		for _,step in pairs(tweentbl) do
			if typeof(step) == "number" then
				wait(step)
			else
				step:Play()
			end
		end
	end)
end

function applyprops(obj,props)
	for propname,val in pairs(props)do
		obj[propname] = val
	end
end

function cycle(grain)
	local label = gui.Noise
	local source = grain.src
	local newframe
	repeat newframe = source[math.random(1, #source)];
	until newframe ~= grain.last
	label.Image = 'rbxassetid://'..newframe
	local rand = math.random(230,255)
	label.Position = UDim2.new(math.random(.4,.6),0,math.random(.4,.6),0)
	label.ImageColor3 = Color3.fromRGB(rand,rand,rand)
	grain.last = newframe
end

function togglenvg(bool)
	if not animating and nvg then
		nvgevent:FireServer()
		gui.TextButton.Visible = not bool
		animating = true
		nvgactive = bool
		if config.lens then
			config.lens.Material = bool and "Neon" or "Glass"
		end
		if bool then
			playtween(onanim)
			delay(.75,function()
				playtween(on_overlayanim)
				spawn(function()
					while nvgactive do
						cycle(config.dark)
						cycle(config.light)
						wait(0.05)
					end
				end)
				animating = false
			end)
		else
			playtween(offanim)
			delay(.5,function()
				playtween(off_overlayanim)
				animating = false
			end)
		end
	end
end

nvgevent.OnClientEvent:connect(function(nvg,activate)
	local twistjoint = nvg:WaitForChild("twistjoint")
	local config = require(nvg.AUTO_CONFIG)
	local lens = config.lens
	if lens then
		lens.Material = activate and "Neon" or "Glass"
	end
	playtween(config[activate and "onanim" or "offanim"])
end)

local lighting = game.Lighting
local rs = game.ReplicatedStorage

local autolighting = rs:WaitForChild("EnableAutoLighting")

if autolighting.Value then

	function llerp(a,b,t)
		return a*(1-t)+b*t
	end

	local minbrightness = rs:WaitForChild("MinBrightness").Value
	local maxbrightness = rs:WaitForChild("MaxBrightness").Value
	local minambient = rs:WaitForChild("MinAmbient").Value
	local maxambient = rs:WaitForChild("MaxAmbient").Value
	local minoutdoor = rs:WaitForChild("MinOutdoorAmbient").Value
	local maxoutdoor = rs:WaitForChild("MaxOutdoorAmbient").Value

	function setdaytime()
		local newtime = lighting.ClockTime
		local middaydiff = math.abs(newtime-12)
		local f = (1-middaydiff/12)
		lighting.Brightness = llerp(minbrightness,maxbrightness,f)
		lighting.Ambient = minambient:lerp(maxambient,f)
		lighting.OutdoorAmbient = minoutdoor:lerp(maxoutdoor,f)
	end

	game:GetService("RunService").RenderStepped:connect(setdaytime)

end