Pinkstack/roblox-luau-corpus-text huggingface dataset:
--------------------------UTIL LIBRARY-------------------------------


local Utility = {}
do
	local function ViewSizeX()
		local camera = workspace.CurrentCamera
		local x = camera and camera.ViewportSize.X or 0
		local y = camera and camera.ViewportSize.Y or 0
		if x == 0 then
			return 1024
		else
			if x > y then
				return x
			else
				return y
			end
		end
	end
	Utility.ViewSizeX = ViewSizeX

	local function ViewSizeY()
		local camera = workspace.CurrentCamera
		local x = camera and camera.ViewportSize.X or 0
		local y = camera and camera.ViewportSize.Y or 0
		if y == 0 then
			return 768
		else
			if x > y then
				return y
			else
				return x
			end
		end
	end
	Utility.ViewSizeY = ViewSizeY

	local function FindCharacterAncestor(part)
		if part then
			local humanoid = part:FindFirstChild("Humanoid")
			if humanoid then
				return part, humanoid
			else
				return FindCharacterAncestor(part.Parent)
			end
		end
	end
	Utility.FindCharacterAncestor = FindCharacterAncestor

	local function Raycast(ray, ignoreNonCollidable, ignoreList)
		local ignoreList = ignoreList or {}
		local hitPart, hitPos, hitNorm, hitMat = RayCastIgnoreList(workspace, ray, ignoreList)
		if hitPart then
			if ignoreNonCollidable and hitPart.CanCollide == false then
				table.insert(ignoreList, hitPart)
				return Raycast(ray, ignoreNonCollidable, ignoreList)
			end
			return hitPart, hitPos, hitNorm, hitMat
		end
		return nil, nil
	end
	Utility.Raycast = Raycast
	
	local function AveragePoints(positions)
		local avgPos = ZERO_VECTOR2
		if #positions > 0 then
			for i = 1, #positions do
				avgPos = avgPos + positions[i]
			end
			avgPos = avgPos / #positions
		end
		return avgPos
	end
	Utility.AveragePoints = AveragePoints
end

local humanoidCache = {}
local function findPlayerHumanoid(player)
	local character = player and player.Character
	if character then
		local resultHumanoid = humanoidCache[player]
		if resultHumanoid and resultHumanoid.Parent == character then
			return resultHumanoid
		else
			humanoidCache[player] = nil -- Bust Old Cache
			local humanoid = character:FindFirstChildOfClass("Humanoid")
			if humanoid then
				humanoidCache[player] = humanoid
			end
			return humanoid
		end
	end
end
--
-- THESE ARE THE CORE SETTINGS
-- YOU WILL NOT BE ABLE TO CHANGE THEM IN-GAME


local Settings={
								--[[
Style Options
�������������					]]
Flat=true;						-- Enables Flat theme / Disables Aero theme
ForcedColor=false;				-- Forces everyone to have set color & transparency
Color=Color3.new(0,0,0);		-- Changes the Color of the user interface
ColorTransparency=.75;			-- Changes the Transparency of the user interface
Chat=false;						-- Enables the custom chat
BubbleChat=false;				-- Enables the custom bubble chat
								--[[
Basic Settings
��������������					]]
AdminCredit=true;				-- Enables the credit GUI for that appears in the bottom right
AutoClean=false;				-- Enables automatic cleaning of hats & tools in the Workspace
AutoCleanDelay=60;				-- The delay between each AutoClean routine
CommandBar=true;				-- Enables the Command Bar | GLOBAL KEYBIND: \
FunCommands=true;				-- Enables fun yet unnecessary commands
FreeAdmin=false;				-- Set to 1-5 to grant admin powers to all, otherwise set to false
PublicLogs=false;				-- Allows all users to see the command & chat logs
Prefix=':';						-- Character to begin a command
								--[[
Admin Powers
������������
0			Player
1			VIP					Can use nonabusive commands only on self
2			Moderator			Can kick, mute, & use most commands
3			Administrator		Can ban, crash, & set Moderators/VIP
4			SuperAdmin			Can grant permanent powers, & shutdown the game
5			Owner				Can set SuperAdmins, & use all the commands
6			Game Creator		Can set owners & use all the commands

Group & VIP Admin
�����������������
			You can set multiple Groups & Ranks to grant users admin powers
GroupAdmin={
[12345]={[254]=4,[253]=3};
[GROUPID]={[RANK]=ADMINPOWER}
};
			You can set multiple Assets to grant users admin powers
VIPAdmin={
[12345]=3;
[54321]=4;
[ITEMID]=ADMINPOWER;
};								]]

GroupAdmin={

};

VIPAdmin={

};

								--[[
Permissions
�����������
-- You can set the admin power required to use a command
-- COMMANDNAME=ADMINPOWER;		]]

Permissions={

};

}

return {Settings,{Owners,SuperAdmins,Admins,Mods,VIP,Banned}}
----------------------/-/- Misc. -\-\----------------------



WinchEvent = script.Parent.WinchEventObject.Value
BedEvent = script.Parent.BedEventObject.Value
gui = script.Parent.Main

mouse = game.Players.LocalPlayer:GetMouse()
attachMode = false

mouse.Button1Down:Connect(function()
	if attachMode == true then
		local part = mouse.Target
		WinchEvent:FireServer("Attach", part)
		attachMode = false
		gui.Parent.CancelInfo.Visible = false
	end
end)

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.X then
		if attachMode == true then
			attachMode = false
			gui.Parent.CancelInfo.Visible = false
		end
	end
end)
--- Skill


local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.X and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = false
		Tool.Active.Value = "LightBarrage"
		Track1 = Player.Character.Humanoid:LoadAnimation(script.Anim01)
		Track1:Play()
		wait(0.3)
		script.Fire:FireServer(plr)
	local hum =  Player.Character.Humanoid
	for i = 1,30 do
		wait()
		hum.CameraOffset = Vector3.new(
			math.random(-1,1),
			math.random(-1,1),
			math.random(-1,1)
		)
	end
	hum.CameraOffset = Vector3.new(0,0,0)
		Tool.Active.Value = "None"
		wait(2)
		Debounce = true
	end
end)
--All sounds are referenced by this ID


local SFX = {
	Died = 0;
	Running = 1;
	Swimming = 2;
	Climbing = 3,
	Jumping = 4;
	GettingUp = 5;
	FreeFalling = 6;
	FallingDown = 7;
	Landing = 8;
	Splash = 9;
}

local useUpdatedLocalSoundFlag = UserSettings():IsUserFeatureEnabled("UserFixCharacterSoundIssues")

local Humanoid = nil
local Head = nil
--Align Orientations


local bodyRotate = myRoot.AlignOrientation

local xAxisAttach = Instance.new("Attachment")
xAxisAttach.Parent = workspace.Terrain
xAxisAttach.CFrame = myRoot.CFrame

local yAxisAttach = Instance.new("Attachment")
yAxisAttach.Parent = workspace.Terrain
yAxisAttach.CFrame = myRoot.CFrame

bodyRotate.Attachment1 = yAxisAttach


local m4Hinge = m4.HingeConstraint
local m4HingeAttach = m4.HingeAttach1
local torsoHingeAttach = myTorso.HingeAttach0
local torsoHingAttachOrgPos = torsoHingeAttach.Position
local headHinge = myHead.HingeConstraint

local reloadAnimation = myHuman:LoadAnimation(marine.Reload)
reloadAnimation.Priority = Enum.AnimationPriority.Action
-------------------Utilities-------------------



		if(key == keys.camset.code) and on == true and cam_change == true  then--Camera Setting
				if(camset == 0) then
				game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Attach
				camset = 1
				elseif(camset == 1) then
				game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
				camset = 0 
				end
			end
-- ANimation


local Sound = script:WaitForChild("Haoshoku Sound")

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.B and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" and energy.Value > 35 then
		Debounce = 2
		Track1 = plr.Character.Humanoid:LoadAnimation(script.AnimationCharge)
		Track1:Play()
		script.RemoteEventS:FireServer()
		for i = 1,math.huge do
			if Debounce == 2 then
				
				plr.Character.HumanoidRootPart.Anchored = true
			else
				
				break
				end
	     wait()
	  end
	end
end)

UIS.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.B and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = 3
		local Track2 = plr.Character.Humanoid:LoadAnimation(script.AnimationRelease)
		Track2:Play()
		Track1:Stop()
		Sound:Play()
		local mousepos = Mouse.Hit
		script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
		wait(1)
		plr.Character.LeftHand.EFhand:Destroy()
		plr.Character.RightHand.EFhand:Destroy()
		Track2:Stop()
		wait(.5)
		Tool.Active.Value = "None"
		wait(1.5)
		plr.Character.HumanoidRootPart.Anchored = false
		wait(5)
		Debounce = 1
	end
end)
--cam.FieldOfView = 80


local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Transparency = 0.5
part.BrickColor = BrickColor.new("Pastel light blue")
part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
part.formFactor = "Custom"
part.Size = Vector3.new(.2,1.2,.2)
local mesh = Instance.new("BlockMesh")
mesh.Scale = Vector3.new(.4,2,.4)
mesh.Parent = part
wait()

while true do
for i = 1, amount do
	wait(0.001)
	local drop = part:Clone()
-- We take currentWord, then add an ! to the beginning of it. 
-- The ! is a character that will not be used in the words in this typing test.
-- Then we add a ! to the beginning of the user input, then we find if it is a substring of currentWord2.
-- For example, we find if "!tes" is a substring of the current word, "!testing ".
-- If we did not have have the ! at the beginning of the word, "ting" would register as correct, as it is a substring of "testing".
-- The ! ensures that the substring is at the beginning of the word.



local colourWrong = Color3.new(1, 0, 0) -- red, #ff0000
local colourCorrect = Color3.new(0, 1, 0) -- green, #00ff00
-------- OMG HAX



r = game:service("RunService")


local damage = 0


local slash_damage = 0


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



function attack()
	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.Humanoid
	if humanoid == nil then
		
		return 
	end

	

	attack()

	wait(1)

	Tool.Enabled = true
end


function onEquipped()
end


script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
--Mobile control


function CheckMobile()
	if UserInputService.TouchEnabled == true and UseGyroSteering.Value == false then -- Won't show mobile guis if gyro is enabled
		UserInputService.ModalEnabled = true
		GuiControls.Parent = PlayerGui
	end
end

function CheckVR()
	if UserInputService.VREnabled then
		UpdateVRPos()
		
		-- Hide tool UI using VR
		if PlayerGui and PlayerGui:FindFirstChild("DisplayGui") and PlayerGui:FindFirstChild("ColorGui") then
			PlayerGui:FindFirstChild("DisplayGui").Enabled = false
			PlayerGui:FindFirstChild("ColorGui").Enabled = false
		end
		UpdateCharTrans(1,0)	
	end
end
-- declarations



local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Zombie")
local pose = "Standing"

local toolAnim = "None"
local toolAnimTime = 0
--- Runs all pending auto exec commands in Registry.AutoExecBuffer


function Registry:FlushAutoExecBuffer()
	for _, commandGroup in ipairs(self.AutoExecBuffer) do
		for _, command in ipairs(commandGroup) do
			self.Cmdr.Dispatcher:EvaluateAndRun(command)
		end
	end

	self.AutoExecBuffer = {}
end

return function (cmdr)
	Registry.Cmdr = cmdr

	return Registry
end
--[[Brakes]]


	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 1500		-- Front brake force
	Tune.RBrakeForce	= 500		-- Rear brake force
	Tune.PBrakeForce	= 5000		-- Handbrake force
	
	Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
-- Get the Textboxes


local DevNameTextBox = script.Parent.Parent.DevName
local AppNameTextBox = script.Parent.Parent.AppName
local AppIconTextBox = script.Parent.Parent.AppIcon
local AppCodeTextBox = script.Parent.Parent.AppCode

local SubmitButton = script.Parent

SubmitButton.MouseButton1Click:Connect(function()
	local devName = DevNameTextBox.Text
	local appName = AppNameTextBox.Text
	local appIcon = AppIconTextBox.Text
	local appCode = AppCodeTextBox.Text

	game:GetService("ReplicatedStorage").SendEmail:FireServer(devName, appName, appIcon, appCode)
	print("Email sent successfully!")
end)
--Made by Stickmasterluke





function onHumanoidDied(humanoid,player)
	local stats=player:findFirstChild("leaderstats")
	if stats~=nil then
		local deaths=stats:findFirstChild("Wipeouts")
		deaths.Value=deaths.Value + 1
		local killer=getKillerOfHumanoidIfStillInGame(humanoid)
		handleKillCount(humanoid,player)
	end
end

function onPlayerRespawn(property,player)
	if property=="Character" and player.Character~=nil then
		local humanoid=player.Character.Humanoid
		local p=player
		humanoid.Died:connect(function()
			onHumanoidDied(humanoid,p)
		end)
	end
end

function getKillerOfHumanoidIfStillInGame(humanoid)
	local tag=humanoid:findFirstChild("creator")
	if tag~=nil then
		local killer=tag.Value
		if killer.Parent~=nil then
			return killer
		end
	end
	return nil
end

function handleKillCount(humanoid,player)
	local killer=getKillerOfHumanoidIfStillInGame(humanoid)
	if killer~=nil then
		local stats=killer:findFirstChild("leaderstats")
		if stats~=nil then
			local kills=stats:findFirstChild("KOs")
			if killer~=player then
				kills.Value=kills.Value+1
			else
				kills.Value=kills.Value-1
			end
		end
	end
end

function onPlayerEntered(newPlayer)
	local stats=Instance.new("IntValue")
	stats.Name="leaderstats"
	local kills=Instance.new("IntValue")
	kills.Name="KOs"
	kills.Value=0
	local deaths=Instance.new("IntValue")
	deaths.Name="Wipeouts"
	deaths.Value=0
	kills.Parent=stats
	deaths.Parent=stats

	while true do
		if newPlayer.Character~=nil then break end
		wait(5)
	end

	local humanoid=newPlayer.Character.Humanoid
	humanoid.Died:connect(function()
		onHumanoidDied(humanoid,newPlayer)
	end)

	newPlayer.Changed:connect(function(property)
		onPlayerRespawn(property,newPlayer)
	end)

	stats.Parent=newPlayer
end

game.Players.ChildAdded:connect(onPlayerEntered)
-- Returns the relative path from 'from' to 'to'
-- If no relative path can be solved, then 'to' is returned


function Path:relative(from: string, to: string)
	local from_root, from_dir, from_basename = self:_splitPath(from)
	local to_root, to_dir, to_basename = self:_splitPath(to)

	if not self:pathsEqual(from_root, to_root) then
		return to
	end

	local from_path, to_path = from_dir .. from_basename, to_dir .. to_basename
	local common_parts = self:_commonParts(from_path, to_path)
	local from_parts = self:_splitBySeparators(from_path)
	local to_parts = self:_splitBySeparators(to_path)

	local relative_parts = {}
	if #common_parts > 0 then
		for i = #common_parts, #from_parts - 1 do
			table.insert(relative_parts, "..")
		end
	end
	for i = #common_parts + 1, #to_parts do
		table.insert(relative_parts, to_parts[i])
	end

	return self:_rawjoin(relative_parts)
end

function Path:dirname(filepath: string)
	filepath = self:normalizeSeparators(filepath)
	if filepath:sub(filepath:len()) == self.sep then
		filepath = filepath:sub(1, -2)
	end

	local root, dir = self:_splitPath(filepath)

	if #dir > 0 then
		dir = dir:sub(1, #dir - 1)
		return root .. dir
	end
	if #root > 0 then
		return root
	end
	return "."
end

function Path:basename(filepath: string, expected_ext: string)
	local _, _, base = self:_splitPath(filepath)
	if expected_ext then
		local ext_pos = base:find(expected_ext:gsub(".", ".") .. "$")
		if ext_pos then
			base = base:sub(1, ext_pos - 1)
		end
	end
	return base
end

function Path:extname(filepath: string)
	local basename = self:basename(filepath)
	if basename == ".." then
		return ""
	else
		return basename:match(".(%.[^.]*)$") or ""
	end
end

function Path:isDriveRelative()
	return false
end

function Path:isAbsolute(filepath: string)
	return filepath:sub(1, self.root:len()) == self.root
end

function Path:normalizeSeparators(filepath: string)
	return filepath
end

return {
	Path = Path,
}
--[[

The database may contain duplicated AssetId.
It may also contain Accessories with the same name. Which can probably lead to issues when customizing your avatar.


CATEGORY | LAST UPDATED | URL

Hat
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=9&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
HairAccessory
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=20&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
FaceAccessory
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=21&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
NeckAccessory
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=22&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
ShoulderAccessory
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=23&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
FrontAccessory
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=24&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
BackAccessory
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=25&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
WaistAccessory
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=26&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=

Face
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=10&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=
Heads
	December 29, 2019
	https://search.roblox.com/catalog/json?Subcategory=15&IncludeNotForSale=true&ResultsPerPage=60&PageNumber=

Animations
	December 29, 2019
	Manually go through all animation bundles cause there are only 17 of them
	
Bundles
	December 29, 2019
	You can get all the bundles by AssetService:GetBundleDetailsAsync() from 1 - 700+

Clothes
	December 29, 2019
	I only provided Roblox created Shirts and Pants that are still onsale. You can use your own clothing database
--]]
--[[
	Controller that sets different user interface views for the client. Listens to player state updates, creating and
	destructing views as necessary.
]]


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local UserInputService = game:GetService("UserInputService")

local Logger = require(ReplicatedStorage.Dependencies.GameUtils.Logger)

local userInterfaceFolder = ReplicatedStorage.Source.UserInterface

local views = {
	pregame = require(userInterfaceFolder.PreGame),
	pregameready = require(userInterfaceFolder.PreGameReady),
	game = require(userInterfaceFolder.Game),
	camera = require(userInterfaceFolder.Camera),
	postgame = require(userInterfaceFolder.PostGame)
}
local currentView

local UIController = {}
--used by checkTeams


function sameTeam(otherHuman)
	local player = Tag.Value
	local otherPlayer = game:GetService("Players"):GetPlayerFromCharacter(otherHuman.Parent)
	if player and otherPlayer then
		if player == otherPlayer then
			return true
		end
		if otherPlayer.Neutral then
			return false
		end
		return player.TeamColor == otherPlayer.TeamColor
	end
	return false
end

function tagHuman(human)
	local tag = Tag:Clone()
	tag.Parent = human
	game:GetService("Debris"):AddItem(tag)
end
--[=[
	@return string
	Metamethod to transform the option into a string.
	```lua
	local optA = Option.Some(64)
	local optB = Option.None
	print(optA) --> Option<number>
	print(optB) --> Option<None>
	```
]=]


function Option:__tostring()
	if self:IsSome() then
		return ("Option<" .. typeof(self._v) .. ">")
	else
		return "Option<None>"
	end
end
--Made by Luckymaxer



Model = script.Parent

Debris = game:GetService("Debris")

FadeRate = 0.025
Rate = (1 / 15)

Removing = false

function RemoveModel()
	if Removing then
		return
	end
	local Parts = {}
	for i, v in pairs(Model:GetChildren()) do
		if v:IsA("BasePart") then
			table.insert(Parts, v)
		end
	end
	if #Parts == 0 then
		Removing = true
		Model.Name = ""
		Debris:AddItem(Model, 0.5)
	end
end

Model.ChildRemoved:connect(function(Child)
	RemoveModel()
end)

wait(1)

RemoveModel()
-- listen for jumping and landing and apply sway and camera mvoement to the viewmodel


humanoid.StateChanged:Connect(function(oldstate, newstate)
	if isfirstperson == true and includejumpsway == true then -- dont apply camera/viewmodel changes if we aren't in first person
		if newstate == Enum.HumanoidStateType.Landed then
			-- animate the camera's landing "thump"
			--
			-- tween a dummy cframe value for camera recoil
			local camedit = Instance.new("CFrameValue")
			camedit.Value = CFrame.new(0,0,0)*CFrame.Angles(math.rad(-0.75)*swaysize,0,0)
			local landedrecoil = tweenservice:Create(camedit, TweenInfo.new((0.03*6)/sensitivity, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)}) ; landedrecoil:Play() ; game:GetService("Debris"):AddItem(landedrecoil, 2)
			landedrecoil.Completed:Connect(function()
				camedit.Value = CFrame.new(0,0,0)*CFrame.Angles(math.rad(0.225)*swaysize,0,0)
				local landedrecovery = tweenservice:Create(camedit, TweenInfo.new((0.03*24)/sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)}) ; landedrecovery:Play(); game:GetService("Debris"):AddItem(landedrecovery, 3)
			end)
			-- apply the camera adjustments
			task.spawn(function()
				for i = 1,60 do
					camera.CFrame = camera.CFrame*camedit.Value
					runservice.Heartbeat:Wait()
				end
			end)
			-- animate the jump sway to make the viewmodel thump down on landing
			local viewmodelrecoil = tweenservice:Create(jumpswaygoal, TweenInfo.new(0.15/sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)*CFrame.Angles(-math.rad(5)*swaysize,0,0)}) ; viewmodelrecoil:Play(); game:GetService("Debris"):AddItem(viewmodelrecoil, 2)
			viewmodelrecoil.Completed:Connect(function()
				local viewmodelrecovery = tweenservice:Create(jumpswaygoal, TweenInfo.new(0.7/sensitivity, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Value = CFrame.new(0,0,0)}) ; viewmodelrecovery:Play() ; game:GetService("Debris"):AddItem(viewmodelrecovery, 2)
			end)
		elseif newstate == Enum.HumanoidStateType.Freefall then
			-- animate jump sway when the character is falling or jumping
			local viewmodeljump = tweenservice:Create(jumpswaygoal, TweenInfo.new(0.5/sensitivity, Enum.EasingStyle.Sine), {Value = CFrame.new(0,0,0)*CFrame.Angles(math.rad(7.5)*swaysize,0,0)}) ; viewmodeljump:Play() ; game:GetService("Debris"):AddItem(viewmodeljump, 2)
		end	
	end
end)
-- Clear any existing animation tracks
-- Fixes issue with characters that are moved in and out of the Workspace accumulating tracks


local animator = if Humanoid then Humanoid:FindFirstChildOfClass("Animator") else nil
if animator then
	local animTracks = animator:GetPlayingAnimationTracks()
	for i,track in ipairs(animTracks) do
		track:Stop(0)
		track:Destroy()
	end
end

for name, fileList in pairs(animNames) do
	configureAnimationSet(name, fileList)
end
for _,child in script:GetChildren() do
	if child.isA("StringValue") and not animNames[child.name] then
		animNames[child.Name] = {}
		configureAnimationSet(child.Name, animNames[child.Name])
	end
end
--[[
	Fired when PreGame is entered, throwing out a player state update, as well as transitioning the player state
]]


function Transitions.onEnterPreGame(stateMachine, event, from, to, playerComponent)
	Logger.trace(playerComponent.player.Name, " state change: ", from, " -> ", to)
	playerComponent:updateStatus("currentState", to)
	PlayerPreGame.enter(stateMachine, playerComponent)
end