Roblox/luau_corpus huggingface dataset:
-- url : (string, read-only) copy of target url that httpRequestFunc will hit
-- httpRequestFunc : (function<dictionary>(void))
local function commonHttpHandler(url, httpRequestFunc)
	assert(type(url) == "string", "expected 'url' to be a string")
	assert(type(httpRequestFunc) == "function", "expected 'httpRequestFunc' to be a function")

	local p = Promise.new(function(resolve, reject)

		spawn(function()
			local startTime = tick()
			local success, resultDict = pcall(httpRequestFunc)
			local endTime = tick()
			local deltaMs = (endTime - startTime) * 1000

			if success then
				local body = resultDict["Body"]
				local requestSuccess = resultDict["Success"]
				local statusMsg = resultDict["StatusMessage"]
				local statusCode = resultDict["StatusCode"]

				if requestSuccess == true then
					resolve(HttpResponse.new(body, statusCode, deltaMs))
				else
					reject(HttpError.new(url, statusMsg, body, statusCode, deltaMs))
				end
			else
				-- the request timed out, or something went wrong
				reject(HttpResponse.new(url, "Unknown Error", resultDict, 500, deltaMs))
			end

			if DEBUG_HTTP then
				local msg = table.concat(
				{
					"--------------------------",
					"Fetching Url :" .. url, "",
					"Success :" .. tostring(success), "",
					"Result :", recursiveToString(resultDict),
					"--------------------------"
				}, "\n")
				print(msg)
			end
		end)
	end)

	return p
end



local Networking = {}
Networking.__index = Networking
--[[
	Stage implementation
]]

local Gameplay = {}
Gameplay.__index = Gameplay

function Gameplay.new(gameStageHandler)
	local self = setmetatable({
		gameStageHandler = gameStageHandler,
		playerCharacters = {},
	}, Gameplay)

	return self
end

function Gameplay:initialize()
	-- Start systems
	ServerTime.run()

	-- Pass shrinking barrier the dividing angle if there are teams
	local randomGenerator = Random.new()
	local directionAngle = randomGenerator:NextNumber(0, math.pi * 2)
	ShrinkingBarrier.run(directionAngle)

	-- Spawn delivery vehicle (or multiple if there are teams)
	local stormPos, stormRadius = ShrinkingBarrier.getTargetPositionAndRadius()
	if Conf.num_teams == 0 then
		local deliveryVehicle = DeliveryVehicle.new()
		deliveryVehicle:spawn(stormPos, stormRadius, directionAngle, 0)
		deliveryVehicle:beginDelivery()
	else
		for i = 1, Conf.num_teams do
			local deliveryVehicle = DeliveryVehicle.new()
			deliveryVehicle:spawn(stormPos, stormRadius, directionAngle, i)
			deliveryVehicle:beginDelivery()
		end
	end
	
	-- Setup character
	for _, player in pairs(Players:GetPlayers()) do
		if player.Character then
			self:setupCharacter(player, player.Character)
		end
	end
end

function Gameplay:destroy()
	self.playerCharacters = nil
end

function Gameplay:characterAdded(player, character)
	self:setupCharacter(player, character)
end

function Gameplay:playerAdded(player)
	local warningMessage = "Player " .. player.Name .. " joined after game start"
	warn(warningMessage)
	WarningEvent:FireAllClients(warningMessage)
end

function Gameplay:setupCharacter(player, character)
	if Conf.player_nil_parent_enabled then
		-- Unparent the player character, but keep a reference so they don't get thrown away
		self.playerCharacters[player] = player.Character
		player.Character.Parent = nil
	elseif not PlayerMatchInfo.GetField(player, "didJump") then
		-- Give the player the Pistol as the default starting weapon
		ReplicatedStorage.Assets.Weapons.Pistol:Clone().Parent = player.Backpack

		-- Grant the player a force field so they cant be killed in the waiting area
		local forceField = Instance.new("ForceField")
		forceField.Name = "WaitingToJumpForceField"
		forceField.Visible = false
		forceField.Parent = character
	end
end

return Gameplay
--// Damage Settings	
	BaseDamage = 43; -- Torso Damage
	LimbDamage = 40; -- Arms and Legs
	ArmorDamage = 21; -- How much damage is dealt against armor (Name the armor "Armor")
	HeadDamage = 2000; -- If you set this to 100, there's a chance the player won't die because of the heal script
--fs.Reflectance = 0.15
--bs.Reflectance = 0.15
ch1.Transparency = 1+(val1.Value-135)*(0.85/65)
ch2.Transparency = 1+(val1.Value-135)*(0.85/65)
ch3.Transparency = 1+(val1.Value-135)*(0.85/65)
end
if val1.Value == 200 then
ch1m.MaxVelocity = 0
ch2m.MaxVelocity = 0
ch3m.MaxVelocity = 0
end

if script.Parent.ReadyProc.Value >= 200 then
script.Parent.BladeReady.Value = true
else
script.Parent.BladeReady.Value = false
end



end
--////////////////////////////// Include
--//////////////////////////////////////
local ChatConstants = require(replicatedModules:WaitForChild("ChatConstants"))
local Util = require(modulesFolder:WaitForChild("Util"))

local ChatLocalization = nil
--[[Wheel Alignment]]
	--[Don't physically apply alignment to wheels]
	--[Values are in degrees]
	Tune.FCamber		= -5
	Tune.RCamber		= -5
	Tune.FToe			= 0
	Tune.RToe			= 0
--[[
	Package link auto-generated by Rotriever
]]
local PackageIndex = script.Parent.Parent.Parent._Index

local Package = require(PackageIndex["TestEZJestAdapter"]["TestEZJestAdapter"])

return Package
--[[ LawlR fix ]]--

local ds = game:GetService("Debris")
local ps = game:GetService("Players")

wait(1)

local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local mousePosRemote = tool.RemoteFunction
local hitScript = tool.HitScript
local throwSound = handle.Throw
local hitSound = handle.Hit
local mesh = handle.Mesh

local cooldown = .4
local vel = 80

local db
local plr, chr, hum

local star = Instance.new("Part")
star.Name = "Ninjastar"
star.Shape = Enum.PartType.Block
star.Material = Enum.Material.Plastic
star.TopSurface = Enum.SurfaceType.Smooth
star.BottomSurface = Enum.SurfaceType.Smooth
star.FormFactor = Enum.FormFactor.Custom
star.Size = Vector3.new(1, 0.4, 1)
star.CanCollide = true
star.Locked = true
mesh:Clone().Parent = star
hitSound.Parent = star
hitScript.Parent = star
hitScript.Disabled = false


local function shoot(pos)
	handle.Transparency = 1
	throwSound:Play()

	local dir = CFrame.new(handle.Position, pos)
	local from = (handle.CFrame + dir.LookVector * 10)

	local star = star:clone()
	star.CFrame = CFrame.new(from.Position)
	star.Velocity = (dir.LookVector * vel)

	local force = Instance.new("BodyForce")
	force.Force = Vector3.new(0, 40, 0)

	local ownerTag = Instance.new("ObjectValue")
	ownerTag.Name = "Owner"
	ownerTag.Value = plr
	ownerTag.Parent = star
	
	force.Parent = star
	star.Parent = workspace
end


tool.Activated:Connect(function()
	if not db and plr then
		db = true
		tool.Enabled = false
		local pos = mousePosRemote:InvokeClient(plr)
		if pos and typeof(pos) == "CFrame" then
			shoot(pos.Position)
		end
		wait(chr:FindFirstChild("NinjaMaskOfLight") and cooldown/2 or cooldown)
		handle.Transparency = 0
		db = false
		tool.Enabled = true
	end
end)

tool.Equipped:Connect(function()
	local tempChr = tool.Parent
	local tempHum = tempChr:FindFirstChildWhichIsA("Humanoid")
	if tempHum then
		chr = tempChr
		hum = tempHum
		plr = ps:GetPlayerFromCharacter(tempChr)
	end
end)
-- Assign grouping hotkeys
AssignHotkey({ 'LeftShift', 'G' }, Support.Call(GroupSelection, 'Model'))
AssignHotkey({ 'RightShift', 'G' }, Support.Call(GroupSelection, 'Model'))
AssignHotkey({ 'LeftShift', 'F' }, Support.Call(GroupSelection, 'Folder'))
AssignHotkey({ 'RightShift', 'F' }, Support.Call(GroupSelection, 'Folder'))
AssignHotkey({ 'LeftShift', 'U' }, UngroupSelection)
AssignHotkey({ 'RightShift', 'U' }, UngroupSelection)

function GetPartsFromSelection(Selection)
	local Parts = {}

	-- Get parts from selection
	for _, Item in pairs(Selection) do
		if Item:IsA 'BasePart' then
			Parts[#Parts + 1] = Item

		-- Get parts within other items
		else
			for _, Descendant in pairs(Item:GetDescendants()) do
				if Descendant:IsA 'BasePart' then
					Parts[#Parts + 1] = Descendant
				end
			end
		end
	end

	-- Return parts
	return Parts
end

function IsSelectable(Items)
	-- Returns whether `Items` can be selected

	-- Check each item
	for _, Item in pairs(Items) do

		-- Ensure item exists and is not locked
		if (not Item) or (not Item.Parent) or (Item:IsA 'BasePart' and Item.Locked) then
			return false
		end

		-- Ensure item can be modified
		if not Security.IsItemAllowed(Item, Player) then
			return false
		end
	end

	-- Check if parts intruding into private areas
	local Parts = GetPartsFromSelection(Items)
	if Security.ArePartsViolatingAreas(Parts, Player, true) then
		return false
	end

	-- If no checks fail, items are selectable
	return true

end

function ExportSelection()
	-- Exports the selected parts

	-- Make sure that there are items in the selection
	if #Selection.Items == 0 then
		return;
	end;

	-- Start an export dialog
	local Dialog = Cheer(Tool.Interfaces.ExportDialog, UI).Start();

	-- Send the exporting request to the server
	Try(SyncAPI.Invoke, SyncAPI, 'Export', Selection.Items)

	-- Display creation ID on success
	:Then(function (CreationId)
		Dialog.SetResult(CreationId);
		print('[Building Tools by F3X] Uploaded Export:', CreationId);
	end)

	-- Display error messages on failure
	:Catch('Http requests are not enabled', function ()
		Dialog.SetError('Please enable HTTP requests');
	end)
	:Catch('Export failed due to server-side error', function ()
		Dialog.SetError('An error occurred, try again');
	end)
	:Catch('Post data too large', function ()
		Dialog.SetError('Try splitting up your build');
	end)
	:Catch(function (Error, Stack, Attempt)
		Dialog.SetError('An unknown error occurred, try again')
		warn('❌ [Building Tools by F3X] Failed to export selection', '\n\nError:\n', Error, '\n\nStack:\n', Stack);
	end);

end;
--// Although this feature is pretty much ready, it needs some UI design still.
module.RightClickToLeaveChannelEnabled = false
module.MessageHistoryLengthPerChannel = 100
-- Gets the storage location for packages used by each Dev Modules. The packages
-- that get put in this folder are deduplicated so every distinct version of a
-- package has only one copy.
local function getPackageStorage(): Folder
	local packageStorage = constants.PACKAGE_STORAGE_LOCATION:FindFirstChild(constants.PACKAGE_STORAGE_NAME) :: Folder

	if not packageStorage then
		packageStorage = Instance.new("Folder")
		packageStorage.Name = constants.PACKAGE_STORAGE_NAME
		packageStorage.Parent = constants.PACKAGE_STORAGE_LOCATION
	end

	return packageStorage
end
--| Cooldown value |--
local Cooldown = script.Parent.Parent.CooldownValue
--// Bullet Physics
	BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
	BulletSpeed = 1500; -- Bullet Speed
	BulletSpread = 0; -- How much spread the bullet has
	
	ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
	ExploSpeed = 600; -- Speed for explosive rounds
	
	BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
--[[
    Creates a touched event listener on specified part, that kills any humanoids that touch it
]]
return function(part)
	return part.Touched:Connect(
		function(hit)
			if hit and hit.Parent then
				local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
				if humanoid then
					humanoid.Health = 0
				end
			end
		end
	)
end
-------- OMG HAX

r = game:service("RunService")


local damage = 5


local slash_damage = 12
local lunge_damage = 16

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


local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7

local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6

local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
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("Humanoid") -- 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 lunge()
	damage = lunge_damage

	LungeSound:play()

	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Lunge"
	anim.Parent = Tool
	
	
	force = Instance.new("BodyVelocity")
	force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
	force.Parent = Tool.Parent.Torso
	wait(.2)
	swordOut()
	wait(.2)
	force.Parent = nil
	wait(.4)
	swordUp()

	damage = slash_damage
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

function swordAcross()
	-- parry
end


Tool.Enabled = true
local last_attack = 0
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

	t = r.Stepped:wait()

	if (t - last_attack < .2) then
		lunge()
	else
		attack()
	end

	last_attack = t

	--wait(.5)

	Tool.Enabled = true
end


function onEquipped()
	UnsheathSound:play()
end


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


connection = sword.Touched:connect(blow)
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
	,FastReload = true					--- Automatically operates the bolt on reload if needed
	,SlideLock = false
	,MoveBolt = false
	,BoltLock = false
	,CanBreachDoor = false
	,CanBreak = true					--- Weapon can jam?
	,JamChance = 1000					--- This old piece of brick doesn't work fine >;c
	,IncludeChamberedBullet = true		--- Include the chambered bullet on next reload
	,Chambered = false					--- Start with the gun chambered?
	,LauncherReady = false				--- Start with the GL ready?
	,CanCheckMag = true					--- You can check the magazine
	,ArcadeMode = false					--- You can see the bullets left in magazine
	,RainbowMode = false				--- Operation: Party Time xD
	,ModoTreino = false					--- Surrender enemies instead of killing them
	,GunSize = 2.75
	,GunFOVReduction = 5

	,BoltExtend = Vector3.new(0, 0, 0.375)
	,SlideExtend = Vector3.new(0, 0, 0.4)
-- emote bindable hook
if FFlagAnimateScriptEmoteHook then
	script:WaitForChild("PlayEmote").OnInvoke = function(emote)
		-- Only play emotes when idling
		if pose ~= "Standing" then
			return
		end
	
		if emoteNames[emote] ~= nil then
			-- Default emotes
			playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
			
			return true
		elseif typeof(emote) == "Instance" and emote:IsA("Animation") then
			-- Non-default emotes
			playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)
			return true
		end
		
		-- Return false to indicate that the emote could not be played
		return false
	end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
elseif guntype == 2 then--BullPup
local torso = model.Parent:FindFirstChild("Torso")
if torso ~= nil then
if weldmode == 1 then--barrel pointing upper-right
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25+y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2, 0)
elseif weldmode == 2 then--barrel pointing upper-left
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2 *-1, 0)
elseif weldmode == 3 then--barrel pointing upside-right
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2, 0)
elseif weldmode == 4 then--barrel pointing upside-left
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2 *-1, 0)
end
end
-- run for the first time
if basePortal:GetAttribute('FallbackImage') then 
	updateFallbackImage() 
end
-- wait for the first of the passed signals to fire
local function waitForFirst(...)
	local shunt = Instance.new("BindableEvent")
	local slots = {...}

	local function fire(...)
		for i = 1, #slots do
			slots[i]:Disconnect()
		end

		return shunt:Fire(...)
	end

	for i = 1, #slots do
		slots[i] = slots[i]:Connect(fire)
	end

	return shunt.Event:Wait()
end

local HumanoidReadyUtil = {}
-- Handle remote functions/events
function runStarting(player)
	if player.Character then
		if player.Character:FindFirstChild("FastStartScript") then
			player.Character.FastStartScript.Disabled = false
		end
	end
end
game.ReplicatedStorage.RemoteEvents.RunStarting.OnServerEvent:connect(runStarting)

local behaviourModules = {}

coroutine.wrap(function()
	for _, behaviourScript in ipairs(script.Behaviours:GetChildren()) do
		local success, errMessage = pcall(function() 
			behaviourModules[behaviourScript.Name] = require(behaviourScript) 
		end)
		if not success then
			warn("Failed to load module" ..behaviourScript.Name.. ".\n" ..errMessage)
		end
	end
end)()

function executeBehaviour(player, character, brickTouched, behaviourName)
	if behaviourModules[behaviourName] ~= nil then
		behaviourModules[behaviourName]:ExecuteBehaviour(brickTouched, character)
	end
end
game.ReplicatedStorage.RemoteEvents.ExecuteBehaviour.OnServerEvent:connect(executeBehaviour)
---[[ Font Settings ]]
module.DefaultFont = Enum.Font.Bodoni
module.ChatBarFont = Enum.Font.Bodoni
--Manage input mode
UIS.InputBegan:Connect(function(InputObj)
	local CurrentInputType = Input.InputMode
	if InputObj.KeyCode == Enum.KeyCode.ButtonA or InputObj.KeyCode == Enum.KeyCode.ButtonX or InputObj.KeyCode == Enum.KeyCode.ButtonB then
		Input.InputMode = "Gamepad"
	elseif InputObj.UserInputType == Enum.UserInputType.Keyboard then
		Input.InputMode = "Keyboard" 
	elseif InputObj.UserInputType == Enum.UserInputType.Touch then
		Input.InputMode = "Touch"
		if CurrentInputType~=Input.InputMode then
			RunTouchControls()
		end
	end
	if CurrentInputType~=Input.InputMode then
		script.TypeChanged:Fire(Input.InputMode)
	end
end)

function KeyChanged()
	--Handle ForwardBack
	local ForwardKey = ( KeyStates[KeyMap.Forward.PrimaryKey] or KeyStates[KeyMap.Forward.SecondaryKey] )
	local BackwardKey = ( KeyStates[KeyMap.Backward.PrimaryKey] or KeyStates[KeyMap.Backward.SecondaryKey] )
	if ForwardKey and BackwardKey then
		Input.Forward = 0
	elseif ForwardKey then
		Input.Forward = 1
	elseif BackwardKey then
		Input.Forward = -1
	else
		Input.Forward = 0
	end
	
	--Handle Strafe
	local StrafeLKey = ( KeyStates[KeyMap.StrafeL.PrimaryKey] or KeyStates[KeyMap.StrafeL.SecondaryKey] )
	local StrafeRKey = ( KeyStates[KeyMap.StrafeR.PrimaryKey] or KeyStates[KeyMap.StrafeR.SecondaryKey] )
	if StrafeLKey and StrafeRKey then
		Input.Strafe = 0
	elseif StrafeLKey then
		Input.Strafe = 1
	elseif StrafeRKey then
		Input.Strafe = -1
	else
		Input.Strafe = 0
	end
	
	--Handle Shift
	local ShiftUpKey = ( KeyStates[KeyMap.ShiftUp.PrimaryKey] or KeyStates[KeyMap.ShiftUp.SecondaryKey] )
	local ShiftDownKey = ( KeyStates[KeyMap.ShiftDown.PrimaryKey] or KeyStates[KeyMap.ShiftDown.SecondaryKey] )
	if ShiftUpKey and ShiftDownKey then
		Input.Shift = 0
	elseif ShiftUpKey then
		Input.Shift = 1
	elseif ShiftDownKey then
		Input.Shift = -1
	else
		Input.Shift = 0
	end
-- Object variables
local Seat = script.Parent
local Thrust = Seat.Parent:WaitForChild("Thrust")
local MainPart = Seat.Parent:WaitForChild("Main")
local Force = Thrust:WaitForChild("Force")
local Tilt = Thrust:WaitForChild("Tilt")
-- HELPER FUNCTIONS
----------------------------------------
-- Set the "MotorMaxTorque" property on all of the CylindricalConstraint motors
local function setMotorTorque(torque)
	motorFR.MotorMaxTorque = torque
	motorFL.MotorMaxTorque = torque
	motorBR.MotorMaxTorque = torque
	motorBL.MotorMaxTorque = torque
end
--- Recalculate the window height
function Window:UpdateWindowHeight()
	local windowHeight = LINE_HEIGHT

	for _, child in pairs(Gui:GetChildren()) do
		if child:IsA("GuiObject") then
			windowHeight = windowHeight + child.Size.Y.Offset
		end
	end

	Gui.CanvasSize = UDim2.new(Gui.CanvasSize.X.Scale, Gui.CanvasSize.X.Offset, 0, windowHeight)
	Gui.Size =
		UDim2.new(
		Gui.Size.X.Scale,
		Gui.Size.X.Offset,
		0,
		windowHeight > WINDOW_MAX_HEIGHT and WINDOW_MAX_HEIGHT or windowHeight
	)

	Gui.CanvasPosition = Vector2.new(0, math.clamp(windowHeight - 300, 0, math.huge))
end
--stuff
local tool = script.Parent
local remote = tool:WaitForChild("gunremote")
local gunmodel = tool.GunModel
local handle = gunmodel:FindFirstChild("Handle")
local mainpart = gunmodel:FindFirstChild("mainpart")
local owner = players.LocalPlayer
local ownergui = owner:FindFirstChildOfClass("PlayerGui")
local cam = workspace.CurrentCamera
local mouse = owner:GetMouse()
local character
local humanoid
local head
local hrp
local larmcweld
local rarmcweld
local guncweld
local guncmodel
local maincpart
local boltcweld
local boltcmainpart
local gunclufa
local magcmodel
local reloadmagcmodel
local reloadmagcpart
local reloadmagcweld
local viewmodel
--	if (runAnimKeyframeHandler ~= nil) then
--		runAnimKeyframeHandler:disconnect()
--	end
--	
--	if (runAnimTrack ~= nil) then
--		runAnimTrack:Stop()
--		runAnimTrack:Destroy()
--		runAnimTrack = nil
--	end
	
	return oldAnim
end

function getHeightScale()
	if Humanoid then
		if not Humanoid.AutomaticScalingEnabled then
			return 1
		end
		
		local scale = Humanoid.HipHeight / HumanoidHipHeight
		if AnimationSpeedDampeningObject == nil then
			AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
		end
		if AnimationSpeedDampeningObject ~= nil then
			scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
		end
		return scale
	end	
	return 1
end

local smallButNotZero = 0.0001

function calculateRunSpeed(speed)
	local speedScaled = speed * 1.25
	local heightScale = getHeightScale()
	local runSpeed = speedScaled / heightScale

	return runSpeed	
end

function setRunSpeed(speed)
	local runSpeed = calculateRunSpeed(speed) 

	if runSpeed ~= currentAnimSpeed then
		-- HACK:  TEMP:  Suppressing blending of run animation