Pinkstack/roblox-luau-corpus-text huggingface dataset:
--// All global vars will be wiped/replaced except script



return function(data, env)
	if env then
		setfenv(1, env)
	end

	local playergui = service.PlayerGui
	local localplayer = service.Players.LocalPlayer
	local gui = service.New("ScreenGui")
	local toggle = service.New("ImageButton", gui)
	local gTable = client.UI.Register(gui)

	local clickSound = service.New("Sound")
	clickSound.Parent = toggle
	clickSound.Volume = 0.25
	clickSound.SoundId = "rbxassetid://156286438"

	if client.UI.Get("HelpButton", gui, true) then
		gui:Destroy()
		gTable:Destroy()
		return nil
	end

	gTable.Name = "HelpButton"
	gTable.CanKeepAlive = false

	toggle.Name = "Toggle"
	toggle.BackgroundTransparency = 1
	toggle.Position = UDim2.new(1, -45, 1, -45)
	toggle.Size = UDim2.new(0, 40, 0, 40)
	toggle.Image = client.HelpButtonImage
	toggle.ImageTransparency = 0.35
	toggle.Modal = client.Variables.ModalMode
	toggle.ClipsDescendants = true

	--if client.UI.Get("Chat") then
	--	toggle.Position = UDim2.new(1, -(45+40),1, -45)
	--end

	toggle.MouseButton1Down:Connect(function()
		task.spawn(function()
			local effect = Instance.new("ImageLabel", toggle)
			effect.AnchorPoint = Vector2.new(0.5, 0.5)
			effect.BorderSizePixel = 0
			effect.ZIndex = toggle.ZIndex + 1
			effect.BackgroundTransparency = 1
			effect.ImageTransparency = 0.8
			effect.Image = "rbxasset://textures/whiteCircle.png"
			effect.Position = UDim2.new(0.5, 0, 0.5, 0)
			effect:TweenSize(UDim2.new(0, toggle.AbsoluteSize.X * 2.5, 0, toggle.AbsoluteSize.X * 2.5), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2)
			task.wait(0.2)
			effect:Destroy()
		end)
		local found = client.UI.Get("UserPanel",nil,true)
		if found then
			found.Object:Destroy()
		else
			clickSound:Play()
			client.UI.Make("UserPanel",{})
		end
	end)

	gTable:Ready()
end
--Add a new title to a player's inventory


function functions.AddTitleToInventory(plr: Player, titleName: string)

	local plrStats = plr.leaderstats
	local plrTitles = plrStats.Titles

	if titles:FindFirstChild(titleName) and not plrTitles:FindFirstChild(titleName) then

		local titleValue = Instance.new("StringValue")
		titleValue.Name = titleName
		titleValue.Parent = plrTitles
	end
end
--AdmiralLennox


Chest = script.Parent
Lid = Chest.Lid
Lid.PrimaryPart = Lid.Hinge

increment = 96
debounce = false

function rotate(model, amount)
		for i=1, math.abs(amount/2) do
			model:SetPrimaryPartCFrame(model.Hinge.CFrame * CFrame.fromEulerAnglesXYZ(0,math.pi/amount,0))
			wait()
		end	
end

function openChest()
	print("Clicked on handle.")
	
	if not debounce then
		debounce = true
		if Chest.Open.Value then
			rotate(Lid, increment)
		else
			rotate(Lid, -increment)
		end
		Chest.Open.Value = not Chest.Open.Value
		debounce = false
	else
	end
end

Lid.ClickDetector.MouseClick:Connect(openChest)
-----------------------------------------ONLY EDIT THESE VALUES!!!!!-----------------------------------------
-----!Instructions!-----
--Make sure you have a part in the gun named Barrel, it is where the raycast will shoot from.--
--Just place this script into any gun and edit the values below.--
--Editting anything else will risk breaking it.--
------------------------


Damage = 18
SPS = 19 -- Shots Per Second, gives a limit of how fast the gun shoots.
Recoil = 5 -- [1-10] [1 = Minigun, 10 = Sniper]
WallShoot = false -- Shoots through walls.
GH = false -- [True = RB can't hurt RB.] [False = RB can hurt RB.]
BulletColor = "Cool yellow" -- Any Brickcolor will work.
Flash = true
--Put this script in ServerScriptService


game.Players.PlayerAdded:Connect(function(plr)
	local Tracker = Instance.new("IntValue")
	Tracker.Name = "Tracker"
	Tracker.Parent = plr
    local Clone = game.ServerStorage.SkipGui:Clone()
    Clone.Parent = plr.PlayerGui
end)

local MP = game:GetService("MarketplaceService")
MP.ProcessReceipt = function(receipt)
	local plr = game.Players:GetPlayerByUserId(receipt.PlayerId)
	if game.ServerStorage.Locations:FindFirstChild(tostring(plr.Tracker.Value+1))~=nil then
		local To = workspace:FindFirstChild(game.ServerStorage.Locations:FindFirstChild(tostring(plr.Tracker.Value+1)).Value)
		plr.Character:MoveTo(To.Position)
		local New = Instance.new("StringValue")
		New.Name = plr.Name
		New.Parent = To.Script
		plr.Tracker.Value = plr.Tracker.Value + 1
		return Enum.ProductPurchaseDecision.PurchaseGranted
	else
		warn("PURCHASE DENIED")
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end
--[[
	Temporarily mounts a Roact element in the DataModel so that it can be tested
	with Rhodium.

	Usage:

		local wasClicked = false

		local element = Roact.createElement("TextButton", {
			[Roact.Event.Activated] = function()
				wasClicked = true
			end
		})

		withMountedElement(element, function(button: TextButton)
			button = Rhodium.Element.new(button)
			button:click()
			expect(wasClicked).toBe(true)
		end)
]]



local CoreGui = game:GetService("CoreGui")

local ExperienceComponents = script:FindFirstAncestor("ExperienceComponents")

local Roact = require(ExperienceComponents.Parent.Roact)

local function withMountedElement<T>(element: any, test: (T) -> ())
	local screenGui = Instance.new("ScreenGui")
	screenGui.Name = "RhodiumScreenGui"
	screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	screenGui.Parent = CoreGui

	local handle
	local success, result = pcall(function()
		handle = Roact.mount(element, screenGui)
	end)

	if not success then
		screenGui:Destroy()
		error(result)
	end

	success, result = pcall(function()
		test(screenGui:FindFirstChildWhichIsA("GuiObject"))
	end)

	Roact.unmount(handle)
	screenGui:Destroy()

	if not success then
		error(result)
	end
end

return withMountedElement
-- If you want to know how to retexture a hat, read this:  http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388










debounce = true

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "Hat"   -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(-0,-0,-1) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
		script.Parent.Mesh:clone().Parent = p
		h.Parent = hit.Parent
		h.AttachmentPos = Vector3.new(0, -0.2, 0) -- Change these to change the positiones of your hat, as I said earlier.
		wait(5)		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)
-- Connection class


local Connection = {}
Connection.__index = Connection


function Connection.new(signal, fn)
	return setmetatable({
		_connected = true,
		_signal = signal,
		_fn = fn,
		_next = false,
	}, Connection)
end


function Connection:Disconnect()
	if not self._connected then return end
	self._connected = false

	-- Unhook the node, but DON'T clear it. That way any fire calls that are
	-- currently sitting on this node will be able to iterate forwards off of
	-- it, but any subsequent fire calls will not hit it, and it will be GCed
	-- when no more fire calls are sitting on it.
	if self._signal._handlerListHead == self then
		self._signal._handlerListHead = self._next
	else
		local prev = self._signal._handlerListHead
		while prev and prev._next ~= self do
			prev = prev._next
		end
		if prev then
			prev._next = self._next
		end
	end
end

Connection.Destroy = Connection.Disconnect
-------- OMG HAX



r = game:service("RunService")


local damage = 5


local slash_damage = 4
local lunge_damage = 12

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(.1)
	swordOut()
	wait(.1)
	force.Parent = nil
	wait(.2)
	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)
--function of all111


click.MouseClick:connect(function(player)
	if ready == true then 
		ready = false
		click.MaxActivationDistance = 0
		coverdown()
		menuappear()
		local newtool = tool:clone()
		local newhandle = handle:clone()
		newtool.Parent = sp.Temporary
		newhandle.Parent = sp.Temporary
		newhandle.CFrame = CFrame.new(Vector3.new(newhandle.Position.X, newhandle.Position.Y+1,newhandle.Position.Z))
		
		for _,one in pairs(maingui:GetChildren()) do
				if one:IsA("TextButton") then
					one.MouseButton1Down:connect(function()
						menudisappear()
						newtool.Name = one.Name
						for _,frame in pairs(maingui:GetChildren()) do
							if frame:IsA("Frame") and frame.Name == one.Name then --lol this whole part though
								for _,button in pairs(frame:GetChildren()) do
									if button:IsA("TextButton") then
										button.Visible = true
										button.MouseButton1Down:connect(function()
											newtool.ToolTip = button.Name
											newhandle.Parent = newtool
											newhandle.Anchored = false
											newtool.Cup.Disabled = false
											newtool.Parent = player.Backpack
											coverup()
											for _,v in pairs(button.Parent:GetChildren()) do
												if v:IsA("TextButton") then
													v.Visible = false
												end
											end
											click.MaxActivationDistance = 10
											wait(5)
											ready = true
											script.Fixer.Disabled = false
										end)
									end
								end
							end
						end
					end)
				end
		end
	end
end)
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data


return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	plrData.Money.Gold.Value = plrData.Money.Gold.Value - 8
	plrData.Character.Injuries.BrokenArm.Value = false
end
-------------------------


 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
        if key == "a" then
            	a = true
        elseif key == "d" then
                d = true
        elseif key == "w" then
                w = true
                rwd.Throttle = 1
				rwd.Torque = tq
				lwd.Throttle = 1
				lwd.Torque = ftq
				rrwd.Throttle = 1
				rrwd.Torque = ftq
				rwd.MaxSpeed = 80
				lwd.MaxSpeed = 80
				rrwd.MaxSpeed = 80
                carSeat.Throttle = 1
                carSeat.Torque = 0
                elseif key == "s" then
                s = true    
                carSeat.Throttle = 0
                carSeat.Torque = 0
				rwd.Throttle = -1
				rwd.Torque = brk
				lwd.Throttle = -1
				lwd.Torque = brk
				rrwd.Throttle = -1
				rrwd.Torque = brk
				rwd.MaxSpeed = 15
				lwd.MaxSpeed = 15
				rrwd.MaxSpeed = 15
                end
end)
 
mouse.KeyUp:connect(function (key)
    key = string.lower(key)
        if key == "a" then
                print("a up")
                if d == false then
                m.DesiredAngle = 0
                        n.DesiredAngle = m.DesiredAngle
                end
        elseif key == "d" then
                print("d up")
                if a == false then
                m.DesiredAngle = 0
                        n.DesiredAngle = m.DesiredAngle
end
        end
        a = false
        d = false
end)
 
mouse.KeyUp:connect(function (key)
    key = string.lower(key)
if key == "w" or key == "s" then
        rwd.Throttle = 0
        rwd.Torque = 0
	    lwd.Throttle = 0
		lwd.Torque = 0
		rrwd.Throttle = 0
		rrwd.Torque = 0

       carSeat.Throttle = 0
carSeat.Torque = cst
        end
end)   
               
 
 
limitButton.MouseButton1Click:connect(function()
--Made by Aurarus--



currency = "Money"	-- Change Gold to the currency you want to give
amnt = 20					-- Change 50 to the amount of money you want to give
debounce = false		-- Don't change this

	function onTouch(hit)
		if hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == false then
			if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
			ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
			ThisPlayer.leaderstats:findFirstChild(currency).Value = ThisPlayer.leaderstats:findFirstChild(currency).Value + amnt
			script.Parent.Transparency = 1
			script.Parent.CanCollide = false
			debounce = true
			wait(86400)		-- Respawn time for the cash giver
			script.Parent.Transparency = 0
			script.Parent.CanCollide = true
			debounce = false
			end
		end
	end


script.Parent.Touched:connect(onTouch)
--- Creates raycast points using only vector3 values.
-- @param object BasePart or Bone, the part you want the points to be locally offset from
-- @param table of vector3 values that are in local space relative to the basePart or bone
-- @param optional group string parameter that names the group these points belong to


function Hitbox:SetPoints(object: BasePart | Bone, vectorPoints: {[number]: Vector3}, group: string?)
	for _: number, vector: Vector3 in ipairs(vectorPoints) do
		local point: Point = self:_CreatePoint(group, Hitbox.CastModes[object:IsA("Bone") and "Bone" or "Vector3"])

		point.Instances[1] = object
		point.Instances[2] = vector
		table.insert(self.HitboxRaycastPoints, point)
	end
end
-- ROBLOX TODO START: implement missing RegExp when 'g' flag available (or reimplement without RegExp)


function exports.escapeRegex(str): string
	error("escapeRegex not implemented")
	-- return str:replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1")
end
function exports.toPosixSlashes(str): string
	error("toPosixSlashes not implemented")
	-- return str:replace(REGEX_BACKSLASH, "/")
end

function exports.removeBackslashes(str): string
	error("removeBackslashes not implemented")
	-- return str:replace(REGEX_REMOVE_BACKSLASH, function(match)
	-- 	return match == "\\" and "" or match
	-- end)
end
-- Unequip logic here


function OnUnequipped()

	if FPSHandsEnbled then

		local Rig = DetectRigAsync(MyCharacter)

		if Rig == "R15" then
			local WhitelistedBodyParts = {"LeftHand", "LeftLowerArm", "LeftUpperArm", "RightHand", "RightLowerArm", "RightUpperArm"}
			
			for i, v in pairs(WhitelistedBodyParts) do
				TransparencyConnections[v]:Disconnect()
				TransparencyConnections[v] = nil
			end
		elseif Rig == "R6" then
			local WhitelistedBodyParts = {"Right Arm", "Left Arm"}
			
			for i, v in pairs(WhitelistedBodyParts) do
				TransparencyConnections[v]:Disconnect()
				TransparencyConnections[v] = nil
			end
			
		end	

		if AutoFirstPerson then
			MyPlayer.CameraMode = Enum.CameraMode.Classic
			MyPlayer.CameraMinZoomDistance = 9.6
			task.wait(0.02)
			MyPlayer.CameraMinZoomDistance = game:GetService("StarterPlayer").CameraMinZoomDistance
		end
	end

	Handle.UnequipSound:Play()
	Handle.EquipSound:Stop()
	Handle.EquipSound2:Stop()
	LeftButtonDown = false
	flare.MuzzleFlash.Enabled = false
	Reloading = false
	MyCharacter = nil
	MyHumanoid = nil
	MyTorso = nil
	MyPlayer = nil
	MyMouse = nil


	if OnFireConnection then
		OnFireConnection:disconnect()
	end
	if OnReloadConnection then
		OnReloadConnection:disconnect()
	end
	if FlashHolder then
		FlashHolder = nil
	end
	if WeaponGui then
		WeaponGui.Parent = nil
		WeaponGui = nil
	end
	if RecoilTrack then
		RecoilTrack:Stop()
	end
	if ReloadTrack then
		ReloadTrack:Stop()
	end
end

local function SetReticleColor(color)
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
		for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
			if line:IsA('Frame') then
				line.BorderColor3 = color
			end
		end
	end
end


Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)

while true do
	task.wait(0.033)
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
		WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
		SetReticleColor(NeutralReticleColor)

		local target = MyMouse.Target
		if target and target.Parent then
			local player = PlayersService:GetPlayerFromCharacter(target.Parent)
			if player then
				if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
					SetReticleColor(EnemyReticleColor)
				else
					SetReticleColor(FriendlyReticleColor)
				end
			end
		end
	end
	if Spread and not IsShooting then
		local currTime = time()
		if currTime - LastSpreadUpdate > FireRate * 2 then
			LastSpreadUpdate = currTime
			Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
			UpdateCrosshair(Spread, MyMouse)
		end
	end
end
--//doors


local dl = Instance.new("Motor", script.Parent.Parent.Misc.FL.Door.SS)
dl.MaxVelocity = 0.03
dl.Part0 = script.Parent.FL
dl.Part1 = dl.Parent

local dr = Instance.new("Motor", script.Parent.Parent.Misc.FR.Door.SS)
dr.MaxVelocity = 0.03
dr.Part0 = script.Parent.FR
dr.Part1 = dr.Parent

local wl = Instance.new("Motor", script.Parent.Parent.Misc.FL.Window.SS) --windows
local wr = Instance.new("Motor", script.Parent.Parent.Misc.FR.Window.SS)

wl.MaxVelocity = 0.007
wl.Part0 = script.Parent.Parent.Misc.FL.Door.WD
wl.Part1 = wl.Parent

wr.MaxVelocity = 0.007
wr.Part0 = script.Parent.Parent.Misc.FR.Door.WD
wr.Part1 = wr.Parent
--LIGHTING FUNCTIONS



script.Parent.OnServerEvent:connect(function(pl,n) if lt~=1 then pr = true else pr=false end lt=n
	if lt == 0 then
		RefMt.DesiredAngle = RefMt.CurrentAngle%math.rad(360)
		RefMt.CurrentAngle = RefMt.CurrentAngle%math.rad(360)
		UpdateLt(1,white)
		UpdatePt(false,white)
		StopMt(pr)
		repeat wait() until lt~=0
	elseif lt == 1 then
		wait(.25)
		RefMt.DesiredAngle = RefMt.CurrentAngle%math.rad(360)
		RefMt.CurrentAngle = RefMt.CurrentAngle%math.rad(360)
		UpdateLt(.25,blue)
		UpdatePt(true,blue)
		UpdateMt(0,math.rad(225),4)
		wait(.75)
		repeat
			UpdateMt(0,math.rad(135),0)
			wait(.5)
			if lt~=1 then break end
			UpdateMt(0,math.rad(225),0)
			wait(.5)
		until lt~=1
	elseif lt == 2 then
		UpdateLt(.25,amber)
		UpdatePt(true,amber)
		UpdateMt(0,9e9,1)
		repeat
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdateLt(.25,red) end
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdatePt(true,red) end
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdateLt(.25,amber) end
			if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdatePt(true,amber) end
			wait()
		until lt~=2
	elseif lt == 3 then
		wait(1/6)
		UpdateLt(.25,blue)
		UpdatePt(true,blue)
		UpdateMt(0,9e9,1)
		repeat wait() until lt~=3
	end
end)
-------------------------


function onClicked()
R.BrickColor = BrickColor.new("Really red")
C.One.BrickColor = BrickColor.new("Really black")
C.Two.BrickColor = BrickColor.new("Really black")
C.Three.BrickColor = BrickColor.new("Really black")
C.Four.BrickColor = BrickColor.new("Really black")
C.MIC.BrickColor = BrickColor.new("Really black")
C.A.BrickColor = BrickColor.new("Really black")
C.B.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
--[=[
	Makes a brio that is limited by the lifetime of its parent (but could be shorter)
	and has the new values given.

	@param brio Brio<U>
	@param ... T
	@return Brio<T>
]=]


function BrioUtils.extend(brio, ...)
	if brio:IsDead() then
		return Brio.DEAD
	end

	local values = brio._values
	local current = {}
	for i=1, values.n do
		current[i] = values[i]
	end
	local otherValues = table.pack(...)
	for i=1, otherValues.n do
		current[values.n+i] = otherValues[i]
	end

	local maid = Maid.new()
	local newBrio = Brio.new(unpack(current, 1, values.n + otherValues.n))

	maid:GiveTask(brio:GetDiedSignal():Connect(function()
		newBrio:Kill()
	end))

	maid:GiveTask(newBrio:GetDiedSignal():Connect(function()
		maid:DoCleaning()
	end))

	return newBrio
end
-- functions



function onRunning(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	pose = "Jumping"
end

function onClimbing()
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function onSwimming(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function moveJump()
	RightShoulder.MaxVelocity = 0.1
	LeftShoulder.MaxVelocity = 0.1
  RightShoulder:SetDesiredAngle(0)
	LeftShoulder:SetDesiredAngle(0)
	RightHip:SetDesiredAngle(0)
	LeftHip:SetDesiredAngle(0)
end
--[[Transmission]]


Tune.ClutchType 	= "Clutch"										--[[
	[Types]
		"Clutch"			: Standard clutch, recommended
		"TorqueConverter"	: Torque converter, keeps RPM up
		"CVT"				: CVT, found in scooters
																		]] 
Tune.ClutchMode		= "Speed"									--[[
	[Modes]
		"Speed"		: Speed controls clutch engagement			
		"RPM"		: Speed and RPM control clutch engagement			]]
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 1000		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 800		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 8000		--		Use sliders to manipulate values
	Tune.Redline		= 9000		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 6100
	Tune.PeakSharpness	= 3.8
	Tune.CurveMult		= 0.07
	
	--Incline Compensation
	Tune.InclineComp	= 1.5		-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 450		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 150		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response, lower = more stable RPM)