Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- functions



local function HandleDrop(d)
	local drop	= {
		Model	= nil;
		Outline	= nil;
		Parts	= {};
	}
	
	local model	= ITEMS[d.Name]:Clone()
		model.Parent	= EFFECTS
		model:BreakJoints()
		
	local config	= require(model:WaitForChild("Config"))
	local base		= ITEMS[d.Name]
	
	if base:FindFirstChild("Attachments") then
		local attachments	= d:WaitForChild("Attachments")
		
		for _, attach in pairs(attachments:GetChildren()) do
			local attachment	= ITEMS[attach.Name]:Clone()
			local config		= require(attachment.Config)
			attachment:SetPrimaryPartCFrame(model.PrimaryPart.CFrame * model.PrimaryPart[config.Attach .. "Attach"].CFrame * attachment.PrimaryPart.Attach.CFrame:inverse())
			attachment.Parent	= model
			attachment:BreakJoints()
		end
	end
	
	local outline	= Instance.new("Model")
		outline.Name	= "Outline"
		outline.Parent	= EFFECTS
		
	drop.Model		= model
	drop.Outline	= outline
				
	local center	= model.PrimaryPart:FindFirstChild("Center")
	
	for _, v in pairs(model:GetDescendants()) do
		if v:IsA("BasePart") then
			v.CFrame		= CFrame.new(0, -100, 0)
			v.Anchored		= true
			v.CanCollide	= false
		
			local o	= v:Clone()
				o.Name		= "Outline"
				o.Material	= Enum.Material.Neon
				o.Color		= OUTLINE_COLOR
				o.Size		= o.Size + Vector3.new(OUTLINE_WIDTH, OUTLINE_WIDTH, OUTLINE_WIDTH)
				if o:IsA("MeshPart") then
					o.TextureID	= ""
				end
				o.Parent	= outline
		
			local info	= {
				Part		= v;
				Outline		= o;
				Offset		= CFrame.new();
			}
			
			if center then
				info.Offset	= center.WorldCFrame:toObjectSpace(v.CFrame)
			else
				info.Offset	= model.PrimaryPart.CFrame:toObjectSpace(v.CFrame)
			end
			
			table.insert(drop.Parts, info)
		end
	end
	
	drops[d]	= drop
	
	d.AncestryChanged:connect(function()
		if d.Parent ~= DROPS then
			if drops[d] then
				drops[d].Model:Destroy()
				drops[d].Outline:Destroy()
				drops[d]	= nil
			end
		end
	end)
end
--[[				TS:Create(ArmaClone.REG, TweenInfo.new(0), {Transparency = 0}):Play()
					if ArmaClone:FindFirstChild("REG2") then
						TS:Create(ArmaClone.REG2, TweenInfo.new(0), {Transparency =0}):Play()
					end
]]

					
					for _,v in pairs(ArmaClone:GetDescendants()) do
						if v:IsA('MeshPart') or v:IsA('Part') or v:IsA('UnionOperation') then
							if v.Name == "REG" then
								TS:Create(v, TweenInfo.new(0), {Transparency = 0}):Play()
							end	
						end
					end
					for _,v in pairs(ArmaClone:GetDescendants()) do
						if v:IsA('MeshPart') or v:IsA('Part') or v:IsA('UnionOperation') then
							if v.Name == "ADS" then
								TS:Create(v, TweenInfo.new(0), {Transparency = 1}):Play()
							end
						end
					end

				end
				TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
				TS:Create(game.Lighting.DepthOfField, TweenInfo.new(0.3), {FocusDistance = 0}):Play()
			end
			if not Safe and not AnimDebounce then
				stance = 3
				Evt.Stance:FireServer(stance,Settings,Anims,ArmaClient)
				SprintAnim()
			end
		elseif not Correndo or SpeedPrecision == 0 then
			if not Safe and not AnimDebounce then
				if Aiming then
					stance = 2
					Evt.Stance:FireServer(stance,Settings,Anims,ArmaClient)
					IdleAnim()
				else
					stance = 0
					Evt.Stance:FireServer(stance,Settings,Anims,ArmaClient)
					IdleAnim()
				end
			end
		end
	end
end

Sprinting.Changed:connect(function(Valor)
	Correndo = Valor
	Sprint()
end)
--[[
	Constructs and returns objects which can be used to model independent
	reactive state.
]]



local Dependencies = require(script.Parent.Parent.Dependencies)
local utility = Dependencies.utility

local class = {}

local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}

local function Value(initalValue: unknown)
	local self = setmetatable({
		type = "State",
		kind = "Value",
		-- if we held strong references to the dependents, then they wouldn't be
		-- able to get garbage collected when they fall out of scope
		-- contains all `get` requests
		dependentSet = setmetatable({}, WEAK_KEYS_METATABLE),
		_value = initalValue
	}, CLASS_METATABLE)
	
	return self
end
--Turn Control------------------------------------------------------------------------


YArrow = script.Parent.BimodalTurn.YLamp
GArrow = script.Parent.BimodalTurn.Lamp
DYArrow = script.Parent.BimodalTurn.YDynamicLight
DGArrow = script.Parent.BimodalTurn.DynamicLight
function TurnActive()
	if Turn.Value == 0 then
		GArrow.Enabled = false
		YArrow.Enabled = false
		DGArrow.Enabled = false
		DYArrow.Enabled = false
	elseif Turn.Value == 1 then
		GArrow.Enabled = true
		YArrow.Enabled = false
		DGArrow.Enabled = true
		DYArrow.Enabled = false
	elseif Turn.Value == 2 then
		GArrow.Enabled = false
		YArrow.Enabled = true
		DGArrow.Enabled = false
		DYArrow.Enabled = true
	elseif Turn.Value == 3 then
		GArrow.Enabled = false
		YArrow.Enabled = false
		DGArrow.Enabled = false
		DYArrow.Enabled = false
	end
end
Turn.Changed:connect(TurnActive)
----------------------------------
------------FUNCTIONS-------------
----------------------------------



function Receive(action, ...)
	local args = {...}
	if not ScriptReady then return end
	if action == "activate" then
		if not PlayingEnabled then
			Activate(args[1], args[2])
			specialPiano = args[3];
		end
	elseif action == "deactivate" then
		if PlayingEnabled then
			Deactivate()
		end
	elseif action == "DDD" or args[1] == "DDD" then
		if Player.Name == args[1] or Player.Name == action then
			Deactivate()
		end
	elseif action == "play" then
		for i,v in pairs(args[5]) do
			if v == "Fade" then
				fade = true
			end
		end
		if Player ~= args[1] then
			PlayNoteServer(args[2], args[3], args[4], args[5], args[6], args[7])
		end
	end
end

function Activate(cameraCFrame, sounds)
	PlayingEnabled = true
	MakeHumanoidConnections()
	MakeKeyboardConnections()
	MakeGuiConnections()
	SetCamera(cameraCFrame)
	SetSounds(sounds)
	ShowPiano()
end

function Deactivate()
	SpecialPiano = false
	PlayingEnabled = false
	BreakHumanoidConnections()
	BreakKeyboardConnections()
	BreakGuiConnections()
	HidePiano()
	HideSheets()
	ReturnCamera()	
	Jump()
end

function PlayNoteClient(note)
	PlayNoteSound(note)
	HighlightPianoKey(note)
	Connector:FireServer("play", note, Volume,Transposition.Value)
end

function PlayNoteServer(note, point, range, sounds, vol, special)
	PlayNoteSound(note, point, range, sounds, vol, SpecialPiano or special) -- just incase ;-;
end

function Abort()
	SpecialPiano = false;
	Connector:FireServer("abort")
end

function Transpose(value)
	Transposition.Value = Transposition.Value + value
	
	PianoGui.TransposeLabel.Text = "Transposition: " .. Transposition.Value
end

function VolumeChange(value)
	if (Volume + value <= 1.5) and (Volume + value >= 0.1) then
		Volume = Volume + value;
		PianoGui.VolumeLabel.Text = "Volume: " .. Volume * 100 .. "%";
	end
end
--[[
	This is a test file to demonstrate how ragdolls work. If you don't use
	this file, you need to manually apply the Ragdoll tag to humanoids that
	you want to ragdoll
--]]



local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterPack = game:GetService("StarterPack")
local StarterPlayer = game:GetService("StarterPlayer")

script.RagdollMe.Parent = StarterPlayer.StarterCharacterScripts
--		print("мимо игрока")


		return -- не атакуем
	end
	
	if hit.Parent:FindFirstChild("Owner") ~= nil then -- чьёто
		return -- не атакуем
	end
	
	local tmp=hit.Parent:FindFirstChild("Owner")
	if tmp ~= nil then
		if tmp.Value == bullet.Owner.Value then -- постройка игрока
			-- print("мимо своей постройки")
			return -- не атакуем
		end
	end	
		
	if hit.Parent:findFirstChild("Humanoid") ~= nil then
		local hum=hit.Parent:findFirstChild("Humanoid")
-- ROBLOX deviation: omitted isBuiltInObject and isMap functions because Lua only has one type, the table,
-- for structuring data



local deepCyclicCopyTable, deepCyclicCopyReplaceable

type anyTable = { [any]: any }

function deepCyclicCopyTable(tableToCopy: anyTable, cycles: anyTable)
	local newTable: anyTable = {}

	cycles[tableToCopy] = newTable

	for key, value in pairs(tableToCopy) do
		newTable[key] = deepCyclicCopyReplaceable(value, cycles)
	end

	return newTable
end

function deepCyclicCopyReplaceable(value: any, cycles: anyTable)
	if typeof(value) ~= "table" then
		return value
	elseif cycles[value] then
		return cycles[value]
	else
		local t = deepCyclicCopyTable(value, cycles)
		local mt = getmetatable(value)
		if mt and typeof(mt) == "table" then
			setmetatable(t, mt)
		end
		return t
	end
end

return function(value, cycles)
	cycles = cycles or {}
	setmetatable(cycles, { _mode = "kv" })

	return deepCyclicCopyReplaceable(value, cycles)
end
-- StrangeEnd



player = script.Parent.Parent.Parent.Parent.Parent
money = player.leaderstats.Cash 
price = 400 --Put Price--
tool = game.Lighting.P2000


function buy()
if money.Value >= price then
money.Value = money.Value - price
local a = tool:clone()
a.Parent = player.Backpack


end
end
script.Parent.MouseButton1Down:connect(buy)
--------RIGHT DOOR --------


game.Workspace.doorright.l11.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(106)

game.Workspace.doorright.l12.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(1013)

game.Workspace.doorright.l13.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(1023)

game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
--[[

	MatchTable {
		Some: (value: any) -> any
		None: () -> any
	}

	CONSTRUCTORS:

		Option.Some(anyNonNilValue): Option<any>
		Option.Wrap(anyValue): Option<any>


	STATIC FIELDS:

		Option.None: Option<None>


	STATIC METHODS:

		Option.Is(obj): boolean


	METHODS:

		opt:Match(): (matches: MatchTable) -> any
		opt:IsSome(): boolean
		opt:IsNone(): boolean
		opt:Unwrap(): any
		opt:Expect(errMsg: string): any
		opt:ExpectNone(errMsg: string): void
		opt:UnwrapOr(default: any): any
		opt:UnwrapOrElse(default: () -> any): any
		opt:And(opt2: Option<any>): Option<any>
		opt:AndThen(predicate: (unwrapped: any) -> Option<any>): Option<any>
		opt:Or(opt2: Option<any>): Option<any>
		opt:OrElse(orElseFunc: () -> Option<any>): Option<any>
		opt:XOr(opt2: Option<any>): Option<any>
		opt:Contains(value: any): boolean

	--------------------------------------------------------------------

	Options are useful for handling nil-value cases. Any time that an
	operation might return nil, it is useful to instead return an
	Option, which will indicate that the value might be nil, and should
	be explicitly checked before using the value. This will help
	prevent common bugs caused by nil values that can fail silently.


	Example:

	local result1 = Option.Some(32)
	local result2 = Option.Some(nil)
	local result3 = Option.Some("Hi")
	local result4 = Option.Some(nil)
	local result5 = Option.None

	-- Use 'Match' to match if the value is Some or None:
	result1:Match {
		Some = function(value) print(value) end;
		None = function() print("No value") end;
	}

	-- Raw check:
	if result2:IsSome() then
		local value = result2:Unwrap() -- Explicitly call Unwrap
		print("Value of result2:", value)
	end

	if result3:IsNone() then
		print("No result for result3")
	end

	-- Bad, will throw error bc result4 is none:
	local value = result4:Unwrap()

--]]




local CLASSNAME = "Option"
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 200		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 4.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- 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)
--//N//--


if gear.Value == 0 then
if carSeat.Throttle == 1 then
	rwd.Throttle = 0
	rwd.Torque = cst
	rwd.MaxSpeed = maxspeed
	lwd.Throttle = 0
	lwd.Torque = cst
	lwd.MaxSpeed = maxspeed
	rrwd.Throttle = 0
	rrwd.Torque = cst
	rrwd.MaxSpeed = maxspeed
	
elseif carSeat.Throttle == -1 then
	rb.RB.CanCollide = true
	rb.FB.CanCollide = true
	lfb.RB.CanCollide = true
	lfb.FB.CanCollide = true
	rfb.RB.CanCollide = true
	rfb.FB.CanCollide = true
	wait(brakes)
	rb.RB.CanCollide = false
	rb.FB.CanCollide = false
	lfb.RB.CanCollide = false
	lfb.FB.CanCollide = false
	rfb.RB.CanCollide = false
	rfb.FB.CanCollide = false
	wait()
elseif carSeat.Throttle == 0 then
	rwd.Throttle = 0
	rwd.Torque = cst
	rwd.MaxSpeed = maxspeed
	lwd.Throttle = 0
	lwd.Torque = cst
	lwd.MaxSpeed = maxspeed
	rrwd.Throttle = 0
	rrwd.Torque = cst
	rrwd.MaxSpeed = maxspeed
	rb.RB.CanCollide = false
	rb.FB.CanCollide = false
	lfb.RB.CanCollide = false
	lfb.FB.CanCollide = false
	rfb.RB.CanCollide = false
	rfb.FB.CanCollide = false
	end
end
-- Finish:
-- overlay.Position = UDim2.new(-2, 0, -2, -22)
-- overlay.Size = UDim2.new(4.5, 0, 4.65, 30)


print(damagedone)
local overlay = gui.hurtOverlay
overlay.Position = UDim2.new(-2, 0, -2, -22)
overlay.Size = UDim2.new(4.5, 0, 4.65, 30)
-- Activation]:


if TurnCharacterToMouse == true then
	MseGuide = true
	HeadHorFactor = 0
	BodyHorFactor = 0
end


game:GetService("RunService").RenderStepped:Connect(function()
	local CamCF = Cam.CoordinateFrame
	if ((IsR6 and Body["Torso"]) or Body["UpperTorso"])~=nil and Body["Head"]~=nil then	--[Check for the Torso and Head...]
		local TrsoLV = Trso.CFrame.lookVector
		local HdPos = Head.CFrame.p
		if IsR6 and Neck or Neck and Waist then	--[Make sure the Neck still exists.]
			if Cam.CameraSubject:IsDescendantOf(Body) or Cam.CameraSubject:IsDescendantOf(Plr) then
				local Dist = nil;
				local Diff = nil;
				if not MseGuide then	--[If not tracking the Mouse then get the Camera.]
					Dist = (Head.CFrame.p-CamCF.p).magnitude
					Diff = Head.CFrame.Y-CamCF.Y
					if not IsR6 then	--[R6 and R15 Neck rotation C0s are different; R15: X axis inverted and Z is now the Y.]
						Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aSin(Diff/Dist)*HeadVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
						Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang((aSin(Diff/Dist)*BodyVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
					else	--[R15s actually have the properly oriented Neck CFrame.]
						Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aSin(Diff/Dist)*HeadVertFactor), 0, -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor),UpdateSpeed/2)
					end
				else
					local Point = Mouse.Hit.p
					Dist = (Head.CFrame.p-Point).magnitude
					Diff = Head.CFrame.Y-Point.Y
					if not IsR6 then
						Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aTan(Diff/Dist)*HeadVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
						Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang(-(aTan(Diff/Dist)*BodyVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
					else
						Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aTan(Diff/Dist)*HeadVertFactor), 0, (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor), UpdateSpeed/2)
					end
				end
			end
		end
	end
	if TurnCharacterToMouse == true then
		Hum.AutoRotate = false
		Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Mouse.Hit.p.x, Core.Position.Y, Mouse.Hit.p.z)), UpdateSpeed / 2)
	else
		Hum.AutoRotate = true
	end
end)
--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


return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	if plrData.Character.Injuries.BrokenRib.Value == true then
		return true
	end
	return false
end
-- Bindable for when we want touch emergency controls
-- TODO: Click to move should probably have it's own gui touch controls
-- to manage this.


local BindableEvent_OnFailStateChanged = nil
if UIS.TouchEnabled then
	BindableEvent_OnFailStateChanged = Instance.new('BindableEvent')
	BindableEvent_OnFailStateChanged.Name = "OnClickToMoveFailStateChange"
	local CameraScript = script.Parent
	local PlayerScripts = CameraScript.Parent
	BindableEvent_OnFailStateChanged.Parent = PlayerScripts
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(plr, dialogueFolder)
	local Checkpoints = workspace:WaitForChild("Checkpoints")
	local Stage = plr:WaitForChild("leaderstats"):WaitForChild("Stage").Value
	Stage -= 1
	local char = plr.Character
	char:WaitForChild("HumanoidRootPart")
	char:WaitForChild("Head")
	char:WaitForChild("Humanoid")
	char:PivotTo(CFrame.new(Checkpoints[Stage].Position + Vector3.new(0,6,0)))
	wait()
	char:PivotTo(CFrame.new(Checkpoints[Stage].Position + Vector3.new(0,6,0)))
end
------------


Player.Character.Torso["Right Shoulder"]:destroy()
glue11 = Instance.new("Glue", Player.Character.Torso)
glue11.Part0 = Player.Character.Torso
glue11.Part1 = rightrm
glue11.Name = "Right shoulder"
collider11 = Instance.new("Part", rightrm)
collider11.Position = Vector3.new(0,9999,0)
collider11.Size = Vector3.new(1.8,1,1)
collider11.Shape = "Cylinder"
local weld11 = Instance.new("Weld", collider11)
weld11.Part0 = rightrm
weld11.Part1 = collider11
weld11.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
collider11.TopSurface = "Smooth"
collider11.BottomSurface = "Smooth"
collider11.formFactor = "Symmetric"
glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
collider11.Transparency = 1
-- ANIMATION



function stopAllAnimations()
	local oldAnim = currentAnim
	
	currentAnim = ""
	currentAnimInstance = nil
	if (currentAnimKeyframeHandler ~= nil) then
		currentAnimKeyframeHandler:disconnect()
	end

	if (currentAnimTrack ~= nil) then
		currentAnimTrack:Stop()
		currentAnimTrack:Destroy()
		currentAnimTrack = nil
	end

	-- clean up walk if there is one
	if (runAnimKeyframeHandler ~= nil) then
		runAnimKeyframeHandler:disconnect()
	end
	
	if (runAnimTrack ~= nil) then
		runAnimTrack:Stop()
		runAnimTrack:Destroy()
		runAnimTrack = nil
	end
	
	return oldAnim
end


function setAnimationSpeed(speed)
	if speed ~= currentAnimSpeed then
		currentAnimSpeed = speed
		currentAnimTrack:AdjustSpeed(currentAnimSpeed)
	end
end

function keyFrameReachedFunc(frameName)
	if (frameName == "End") then
		if currentAnim == "walk" then
			runAnimTrack.TimePosition = 0.0
			currentAnimTrack.TimePosition = 0.0
		else
			local repeatAnim = currentAnim
			local animSpeed = currentAnimSpeed
			playAnimation(repeatAnim, 0.15, Humanoid)
			setAnimationSpeed(animSpeed)
		end
	end
end

function rollAnimation(animName)
	local roll = math.random(1, animTable[animName].totalWeight) 
	local origRoll = roll
	local idx = 1
	while (roll > animTable[animName][idx].weight) do
		roll = roll - animTable[animName][idx].weight
		idx = idx + 1
	end
	return idx
end

function playAnimation(animName, transitionTime, humanoid) 	
	local idx = rollAnimation(animName)
	local anim = animTable[animName][idx].anim

	-- switch animation		
	if (anim ~= currentAnimInstance) then
		
		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end

		if (runAnimTrack ~= nil) then
			runAnimTrack:Stop(transitionTime)
			runAnimTrack:Destroy()
		end

		currentAnimSpeed = 1.0
	
		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		 
		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName
		currentAnimInstance = anim

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
	end
end
-- Ring4 descending


for l = 1,#lifts4 do
	if (lifts4[l].className == "Part") then
	lifts4[l].BodyPosition.position = Vector3.new((lifts4[l].BodyPosition.position.x),(lifts4[l].BodyPosition.position.y-6),(lifts4[l].BodyPosition.position.z))
	end
end
wait(0.1)
for p = 1,#parts4 do
	parts4[p].CanCollide = false
end
wait(0.1)
--[=[
	Constructs a new Maid which will clean up when the brio dies.
	Will error if the Brio is dead.

	:::info
	Calling this while the brio is already dead will throw a error.
	:::

	```lua
	local brio = Brio.new("a")
	local maid = brio:ToMaid()
	maid:GiveTask(function()
		print("Cleaning up!")
	end)
	brio:Kill() --> Cleaning up!
	```

	@return Maid
]=]


function Brio:ToMaid()
	assert(self._values ~= nil, "Brio is dead")

	local maid = Maid.new()

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

	return maid
end

function Brio:ToMaidAndValue()
	return self:ToMaid(), self:GetValue()
end
--HeroThPianist


local tool = script.Parent.Parent
local event = script.Parent:WaitForChild("PepperSprayEvent")

event.OnServerEvent:connect(function(plr,event,arg1,arg2,arg3)
	if event == "Button1Down" then
		tool.Spray.Transparency = 1
		tool.Spray.Script.Disabled = false
		tool.Nossle.Spray.Enabled = true
		tool.Nossle.Sound:Play()
	elseif event == "Button1Up" then
		tool.Spray.Transparency = 1
		tool.Spray.Script.Disabled = true
		tool.Nossle.Spray.Enabled = false
		tool.Nossle.Sound:Stop()
	end
end)