Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[
	This function fixes a problem where when the Camera's CameraType is set back
	to Enum.CameraType.Custom, it snaps back to the last distance before we
	animated it.

	As such, if the user is zoomed far out, calling `focusCharacter()` will zoom
	in, and then once the animation finishes the camera snaps back to the
	distance it was at before.

	To work around this, we use this function to force the camera's zoom
	distance to the distance that the camera will be from the character when the
	animation completes.
]]


local function _setZoomDistanceHack(player: Player, distance: number, callback: () -> ())
	local min = player.CameraMinZoomDistance
	local max = player.CameraMaxZoomDistance

	player.CameraMinZoomDistance = distance
	player.CameraMaxZoomDistance = distance

	callback()

	player.CameraMinZoomDistance = min
	player.CameraMaxZoomDistance = max
end

local function focusCharacter(player: Player, camera: Camera, offset: number?): RBXScriptSignal
	offset = if offset ~= nil then offset else 10
	-- selene: allow(incorrect_standard_library_use)
	assert(offset)

	local character = player.Character
	local completed = Instance.new("BindableEvent")

	if character and character.PrimaryPart then
		local cameraType = camera.CameraType
		local motor = Otter.createSingleMotor(0)
		local direction = character:GetPrimaryPartCFrame().LookVector
		local goalPosition = camera.Focus.Position + (Vector3.new(offset, 0, offset) * direction)
		local goal = CFrame.lookAt(goalPosition, camera.Focus.Position)

		motor:onStep(function(alpha: number)
			camera.CFrame = camera.CFrame:Lerp(goal, alpha)
		end)

		motor:onComplete(function()
			completed:Fire()

			_setZoomDistanceHack(player, offset, function()
				camera.CameraType = cameraType

				-- Wait a frame to ensure the Camera has time to update based on the
				-- current max zoom distance before we leave this scope and reset it
				task.wait()
			end)
		end)

		camera.CameraType = Enum.CameraType.Scriptable
		motor:setGoal(Otter.spring(1, constants.Springs.Slowpoke))
	end

	return completed.Event
end

return focusCharacter
-- Define the function to open or close the window with gene-alike effect


local function toggleWindow()
	if window.Visible then
		
		window.Visible = false
		opened.Visible = false
		-- Close the window by tweening back to the button position and size
		window:TweenSizeAndPosition(
			UDim2.new(0, 0, 0, 0),
			UDim2.new(0, aFinderButton.AbsolutePosition.X, 0, aFinderButton.AbsolutePosition.Y),
			'Out',
			'Quad',
			0.5,
			false,
			function()
				window.Visible = false
			end
		)
	end
end
-- LOCAL


local tweenService = game:GetService("TweenService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local debris = game:GetService("Debris")
local userInputService = game:GetService("UserInputService")
local httpService = game:GetService("HttpService") -- This is to generate GUIDs
local runService = game:GetService("RunService")
local textService = game:GetService("TextService")
local guiService = game:GetService("GuiService")
local starterGui = game:GetService("StarterGui")
local players = game:GetService("Players")
local IconController = require(script.IconController)
local Signal = require(script.Signal)
local Maid = require(script.Maid)
local TopbarPlusGui = require(script.TopbarPlusGui)
local TopbarPlusReference = require(script.TopbarPlusReference)
local referenceObject = TopbarPlusReference.getObject()
local Themes = require(script.Themes)
local activeItems = TopbarPlusGui.ActiveItems
local topbarContainer = TopbarPlusGui.TopbarContainer
local iconTemplate = topbarContainer["IconContainer"]
local DEFAULT_THEME = Themes.Default
local THUMB_OFFSET = 55
local Icon = (referenceObject and require(referenceObject.Value)) or {}
Icon.__index = Icon
if not referenceObject then
	TopbarPlusReference.addToReplicatedStorage()
end
-- message : (string) the text of error thrown
-- stack : (string) the debug.traceback() of the where the error originated
-- origin : (datatype) the container where the error came from


function ErrorReporter:Report(message, stack, origin)
	-- make sure that there isn't a circular loop of errors
	local success, result = pcall(function()
		if DEBUG_REPORTER then
			local debugMsg = table.concat({
				"Received Error :",
				string.format("Message : (%s) - %s", type(message), message),
				string.format("Stack : (%s) - %s", type(stack), stack),
				string.format("Origin : (%s) - %s", type(origin), getFullPath(origin)),
				"***************************",
			}, "\n")
			print(debugMsg)
		end

		-- format the message and stack
		local strMessage = removePlayerNameFromStack(message)
		local strStack = removePlayerNameFromStack(stack)
		local strOrigin = removePlayerNameFromStack(getFullPath(origin))

		-- report the error to all reporters
		if REPORT_TO_GOOGLE_ANALYTICS then
			local p = self._googleAnalyticsReporter:sendEvent(GAME_VERSION, strMessage, strStack)
			p:andThen(function()
				if PRINT_SUCCESSFUL_GOOGLE_ANALYTICS then
					print("** Successfully reported error to GoogleAnalytics **",
						"(Set Config.PRINT_SUCCESSFUL_GOOGLE_ANALYTICS to false to disable this message)")
				end
			end,
			function(err)
				warn("Error thrown while reporting to GA : ", err)
			end)
		end

		if REPORT_TO_PLAYFAB then
			local category = string.format("Errors-%s", GAME_VERSION)
			local value = {
				error = strMessage,
				stack = strMessage,
				origin = strOrigin,
			}
			self._playFabReporter:fireEvent(category, value)

			-- PlayFab will not work while testing in Studio. It will give you an error saying :
			-- `AnalyticsService can only be executed by game server.`
			-- This means that you have to be playing a published game to get any real data.
			-- But as far as this script cares, you successfully sent data to PlayFab.
			if PRINT_SUCCESSFUL_PLAYFAB then
				print("** Successfully reported error to PlayFab **",
					"(Set Config.PRINT_SUCCESSFUL_PLAYFAB to false to disable this message)")
			end
		end
	end)

	if not success then
		local warning = table.concat({
			"Error Reporter threw an error :",
			tostring(result),
			"While reporting...",
			string.format("Message : (%s) - %s", type(message), message),
			string.format("Stack : (%s) - %s", type(stack), stack),
			string.format("Origin : (%s) - %s", type(origin), tostring(origin)),
		}, "\n")
		warn(warning)
	end
end

return ErrorReporter
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------




function OnRunning(Speed)
	if Speed > 0.01 then
		PlayAnimation("Walk", 0.1, Humanoid)
		Pose = "Running"
	else
		PlayAnimation("Idle", 0.1, Humanoid)
		Pose = "Standing"
	end
end

function OnDied()
	Pose = "Dead"
end

function OnJumping()
	PlayAnimation("Jump", 0.1, Humanoid)
	JumpAnimTime = JumpAnimDuration
	Pose = "Jumping"
end

function OnClimbing(Speed)
	PlayAnimation("Climb", 0.1, Humanoid)
	SetAnimationSpeed(Speed / 12)
	Pose = "Climbing"
end

function OnGettingUp()
	Pose = "GettingUp"
end

function OnFreeFall()
	if JumpAnimTime <= 0 then
		PlayAnimation("Fall", FallTransitionTime, Humanoid)
	end
	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 GetTool()	
	for i, Tool in pairs(Figure:GetChildren()) do
		if Tool:IsA("Tool") then
			return Tool
		end
	end
	return nil
end

function GetToolAnim(Tool)
	for i, Anim in pairs(Tool:GetChildren()) do
		if string.lower(Anim.Name) == string.lower("ToolAnim") and Anim:IsA("StringValue") then
			return Anim
		end
	end
	return nil
end

function AnimateTool()
	
	if ToolAnim == "None" then
		PlayToolAnimation("ToolNone", ToolTransitionTime, Humanoid)
		return
	end

	if ToolAnim == "Slash" then
		PlayToolAnimation("ToolSlash", 0, Humanoid)
		return
	end

	if ToolAnim == "Lunge" then
		PlayToolAnimation("ToolLunge", 0, Humanoid)
		return
	end
end

function MoveSit()
	--RightShoulder.MaxVelocity = 0.15
	--LeftShoulder.MaxVelocity = 0.15
	--RightShoulder:SetDesiredAngle(3.14 / 2)
	--LeftShoulder:SetDesiredAngle(-3.14 / 2)
	--RightHip:SetDesiredAngle(3.14 / 2)
	--LeftHip:SetDesiredAngle(-3.14 / 2)
	RightHip:SetDesiredAngle(1)
	RightHip.CurrentAngle = RightHip.DesiredAngle
	LeftHip:SetDesiredAngle(-1)
	LeftHip.CurrentAngle = LeftHip.DesiredAngle
end

local LastTick = 0

function Move(Time)
	local Amplitude = 1
	local Frequency = 1
  	local DeltaTime = (Time - LastTick)
  	LastTick = Time

	local ClimbFudge = 0
	local SetAngles = false

  	if JumpAnimTime > 0 then
  		JumpAnimTime = (JumpAnimTime - DeltaTime)
  	end

	if Pose == "FreeFall" and JumpAnimTime <= 0 then
		PlayAnimation("Fall", FallTransitionTime, Humanoid)
	elseif Pose == "Seated" then
		StopAllAnimations()
		MoveSit()
		return
	elseif Pose == "Running" then
		PlayAnimation("Walk", 0.1, Humanoid)
	elseif Pose == "Dead" or Pose == "GettingUp" or Pose == "FallingDown" or Pose == "Seated" or Pose == "PlatformStanding" then
-- Preload animations


function playAnimation(animName, transitionTime, Zombie)
	local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
	if (animName ~= currentAnim and not idleFromEmote) then		 
		
		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end

		currentAnimSpeed = 1.0
		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
--[[
	-----------[ THEMES ]-----------
  

	- LIGHT THEME:
	  If you want the light theme version of the board,
	  replace line 1 with: 
	  
	  require(2925075326).Parent = script.Parent
	
	- DARK THEME:
	  If you want the dark theme version of the board,
	  replace line 1 with: 
	  
	  require(5799918029).Parent = script.Parent


	- RAINBOW THEME:
	  If you want the rainbow theme version of the board,
	  replace line 1 with: 
	  
	  require(6872314867).Parent = script.Parent

--]]
--[[**
	ensure value is an Instance and it's ClassName matches the given ClassName

	@param className The class name to check for

	@returns A function that will return true iff the condition is passed
**--]]


function t.instanceOf(className, childTable)
	assert(t.string(className))

	local childrenCheck
	if childTable ~= nil then
		childrenCheck = t.children(childTable)
	end

	return function(value)
		local instanceSuccess, instanceErrMsg = t.Instance(value)
		if not instanceSuccess then
			return false, instanceErrMsg or ""
		end

		if value.ClassName ~= className then
			return false, string.format("%s expected, got %s", className, value.ClassName)
		end

		if childrenCheck then
			local childrenSuccess, childrenErrMsg = childrenCheck(value)
			if not childrenSuccess then
				return false, childrenErrMsg
			end
		end

		return true
	end
end

t.instance = t.instanceOf
-- NOTE: The Repeating Times, Reversing, And Delay Is OPTIONAL



local TweenGoals = {
	Rotation = 360
}


script.Parent.Parent.Parent.Sound:Play()
local create = TweenService:Create(script.Parent,TweeningInfo,TweenGoals)

while true do 
	create:Play()
	task.wait()
	script.Parent.Rotation = 0
end
--[[
	The task.wait() calls below are placeholders for calling asynchronous functions
	that would load parts of your game.
--]]



local ContentProvider = game:GetService("ContentProvider")

local LoadingScreen = require(script.Parent.LoadingScreen)

local REQUIRED_ASSETS = {
	game.Workspace
}

LoadingScreen.enableAsync()
LoadingScreen.updateDetailText("Preloading important assets...")
ContentProvider:PreloadAsync(REQUIRED_ASSETS)
LoadingScreen.updateDetailText("Initializing...")
task.wait(1.5)
LoadingScreen.updateDetailText("Loading user data...")
task.wait(3)
LoadingScreen.updateDetailText("Spawning character...")
task.wait(3)
LoadingScreen.updateDetailText("Finishing up...")
task.wait(0.5)
LoadingScreen.disableAsync()
--------AUDIENCE BACK LEFT--------



game.Workspace.audiencebackleft1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
-- title macro item



local item = {}

function item:New(itemContainer, macroItem, pluginSettings, updatePluginSettings)
	itemContainer.TextLabel.Text = macroItem.Text
	
	function macroItem:UpdateText(text)
		itemContainer.TextLabel.Text = text
	end
	

	function macroItem:UpdateTheme(theme)
		itemContainer.TextLabel.TextColor3 = theme:GetColor(Enum.StudioStyleGuideColor.MainText)
	end
end

return item
--Left lean Divider


ZR15RightLegLeftLeanD = 1
XR15RightLegLeftLeanD = 1 
YR15RightLegLeftLeanD = 1
R15RightKneeLeftLeanD = 1

ZR15RightArmLeftLeanD = 1
XR15RightArmLeftLeanD = 1
YR15RightArmLeftLeanD = 1
R15RightElbowLeftLeanD = 1

ZR15LeftLegLeftLeanD = 1
XR15LeftLegLeftLeanD = 1 
YR15LeftLegLeftLeanD = 1
R15LeftKneeLeftLeanD = 1

ZR15LeftArmLeftLeanD = 1
XR15LeftArmLeftLeanD = 1
YR15LeftArmLeftLeanD = 1
R15LeftElbowLeftLeanD = 1

ZR15LowerTorsoLeftLeanD = 1
XR15LowerTorsoLeftLeanD = 1
YR15LowerTorsoLeftLeanD = 1
ZR15UpperTorsoLeftLeanD = 1
-- We set our speeds on the server, don't let the client choose


local speeds = {
	run = 24,
	walk = 16
}

character.speed = function(player, payload)
	local humanoid = Util.getHumanoid(player)
	
	if not humanoid or not payload or not speeds[payload.speed] then
		return
	end
	
	humanoid.WalkSpeed = speeds[payload.speed]
end

return character
--[=[
	Fulfills the promise with the value
	@param values { T } -- Params to fulfil with
	@param valuesLength number
	@private
]=]


function Promise:_fulfill(values, valuesLength)
	if not self._pendingExecuteList then
		return
	end

	self._fulfilled = values
	self._valuesLength = valuesLength

	local list = self._pendingExecuteList
	self._pendingExecuteList = nil
	for _, data in pairs(list) do
		self:_executeThen(unpack(data))
	end
end
-- see link for what the dictionary looks like: https://developer.roblox.com/en-us/api-reference/function/Players/GetCharacterAppearanceInfoAsync


local wearingAssets

local originalCamCFrame = camera.CFrame

local function characterAdded()
	character = player.Character
	rootPart = character.PrimaryPart or character:WaitForChild("HumanoidRootPart")
	humanoid = character:FindFirstChildWhichIsA("Humanoid")
	originalCamCFrame = camera.CFrame
end

local function hideAllSubCategoryFrames()
	for i, frame in ipairs(subCategoryFrames) do
		frame.Visible = false
	end
end

local function setSelectedCategory(guiButton)
	for button, class in next, activeCategoryButtons do
		class:SetSelected(false)
	end
	if activeCategoryButtons[guiButton] then
		activeCategoryButtons[guiButton]:SetSelected(true)
	end
end

local function setSelectedSubCategory(guiButton)
	for button, class in next, activeSubCategoryButtons do
		class:SetSelected(false)
	end
	if activeSubCategoryButtons[guiButton] then
		activeSubCategoryButtons[guiButton]:SetSelected(true)
	end
end

local function updateScrollingFrameCanvasSize()
	scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, scrollingFrameUIGridLayout.AbsoluteContentSize.Y)
end

local function updateScaleFrameCanvasSize()
	scaleFrame.CanvasSize = UDim2.new(0, 0, 0, scaleFrameUIGridLayout.AbsoluteContentSize.Y)
end

local function clearSearch()
	searchTextBox.Text = ""
end

local function resetScrollingFrame()
	activeButtons:DoCleaning()
	clearSearch()
	scrollingFrame.CanvasPosition = Vector2.new(0, 0)
end
-- deltarager cried here
-- 27/05/2021



repeat wait() until game:IsLoaded() and game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name) ~= nil and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") ~= nil

local ReplicatedStorage	= game:GetService("ReplicatedStorage")
local UserInputService	= game:GetService("UserInputService")
local constants			= require(ReplicatedStorage["ClientModules"].Constants)

local player	= game.Players.LocalPlayer
local character	= player.Character or player.CharacterAdded:Wait()
local humanoid	= character:WaitForChild("Humanoid")
local animator	= humanoid:WaitForChild("Animator")
local oldEvent1,oldEvent2	= nil,nil
local toolEvent,toolEventDe	= nil,nil

IdleAnimation 	= animator:LoadAnimation(ReplicatedStorage.Animations.Idle)
SprintAnimation = animator:LoadAnimation(ReplicatedStorage.Animations.Sprint)
CrouchAnimation = animator:LoadAnimation(ReplicatedStorage.Animations.Crouch)

local crouching	= false
local sprinting	= false
local equipped	= false
local shooting	= false

local function Crouch()
	if sprinting then
		humanoid.WalkSpeed = 16;
		SprintAnimation:Stop()
		sprinting = false
	end
	if crouching then
		humanoid.WalkSpeed = 16
		CrouchAnimation:Stop()
	else
		if equipped then
			IdleAnimation:Play()
		end
		CrouchAnimation:Play()
		humanoid.WalkSpeed = 10
	end
	crouching	= not crouching
end

local function Sprint()
	if crouching then
		humanoid.WalkSpeed = 16
		CrouchAnimation:Stop()
		if equipped then
			IdleAnimation:Stop()
		end
		crouching = false
	end
	if sprinting then
		humanoid.WalkSpeed = 16;
		if equipped then
			SprintAnimation:Stop()
			IdleAnimation:Play()
		end
	else
		if equipped then
			IdleAnimation:Stop()
			SprintAnimation:Play()
		end
		humanoid.WalkSpeed = 24;
	end
	sprinting		= not sprinting
end


UserInputService.InputBegan:Connect(function(input,gpe)
	if gpe then return end
	if input.KeyCode == constants.sprintKey and not shooting then
		Sprint()
	elseif input.KeyCode == constants.crouchKey then
		Crouch()
	elseif input.KeyCode == Enum.KeyCode.Space then
		if crouching then
			Crouch()
		end
	end 
end)

character.ChildAdded:Connect(function(child)
	if child:IsA("Tool") then
		equipped	= true
		IdleAnimation:Play()
		if sprinting then
			IdleAnimation:Stop()
			SprintAnimation:Play()
		end
		toolEvent		= child.Activated:Connect(function()
			if child.GunType.Value ~= "heal" then
				shooting 	= true
				if sprinting then
					humanoid.WalkSpeed = 16;
					sprinting = false
					SprintAnimation:Stop()
					IdleAnimation:Play()
				end
			end
		end)
		toolEventDe	 	= child.Deactivated:Connect(function()
			shooting 	= false
		end)
	end
end)
character.ChildRemoved:Connect(function(child)
	if child:IsA("Tool") then
		equipped	= false
		IdleAnimation:Stop()
		SprintAnimation:Stop()
		
		if toolEvent ~= nil then
			toolEvent:Disconnect()
			toolEventDe:Disconnect()
		end
	end
end)
-- Necessery Functions



local ErrorPart = nil
local function GetValidPartToLookAt(Char, bodypart)
	local pHum = Char:FindFirstChild("Humanoid")
	if not Char and pHum then return nil end
	local pIsR6 = (pHum.RigType.Value==0)
	if table.find({"Torso", "UpperTorso"}, bodypart) then
		if pIsR6 then bodypart = "Torso" else bodypart = "UpperTorso" end
	end
	local ValidPart = Char:FindFirstChild(bodypart) or Char:FindFirstChild("HumanoidRootPart")
	if ValidPart then return ValidPart else
		if ErrorPart ~= bodypart then
			--warn(Body.Name.." can't find part to look: "..tostring(bodypart))
			ErrorPart = bodypart
		end
		return nil end
end

local function getClosestPlayer() -- Get the closest player in the range.
	local closest_player, closest_distance = nil, LookAtPlayerRange
	for i = 1, #SearchLoc do
		for _, player in pairs(SearchLoc[i]:GetChildren()) do
			if player:FindFirstChild("Humanoid") and player ~= Body 
				and (Players:GetPlayerFromCharacter(player) or LookAtNonPlayer) 
				and GetValidPartToLookAt(player, PartToLookAt) then
				
				local distance = (Core.Position - player.PrimaryPart.Position).Magnitude
				if distance < closest_distance then
					closest_player = player
					closest_distance = distance
				end
			end
		end
	end
	return closest_player
end

local function rWait(n)
	n = n or 0.05
	local startTime = os.clock()

	while os.clock() - startTime < n do
		game:GetService("RunService").Heartbeat:Wait()
	end
end

local function LookAt(NeckC0, WaistC0)
	if not IsR6 then
		if Neck then Neck.C0 = Neck.C0:lerp(NeckC0, UpdateSpeed/2) end
		if Waist then Waist.C0 = Waist.C0:lerp(WaistC0, UpdateSpeed/2) end
	else
		if Neck then Neck.C0 = Neck.C0:lerp(NeckC0, UpdateSpeed/2) end
	end
end
--[[
	Chains a Promise from this one that is resolved if this Promise is
	resolved, and rejected if it is not resolved.
]]


function Promise.prototype:now(rejectionValue)
	local traceback = debug.traceback(nil, 2)
	if self:getStatus() == Promise.Status.Resolved then
		return self:_andThen(traceback, function(...)
			return ...
		end)
	else
		return Promise.reject(rejectionValue == nil and Error.new({
			kind = Error.Kind.NotResolvedInTime,
			error = "This Promise was not resolved in time for :now()",
			context = ":now() was called at:\n\n" .. traceback,
		}) or rejectionValue)
	end
end
------------------------------------------------------------------------
-- reanchor if last token is has a constant string, see close_func()
-- * used only in close_func()
------------------------------------------------------------------------


function luaY:anchor_token(ls)
  if ls.t.token == "TK_NAME" or ls.t.token == "TK_STRING" then
    -- not relevant to Lua implementation of parser
    -- local ts = ls.t.seminfo
    -- luaX_newstring(ls, getstr(ts), ts->tsv.len); /* C */
  end
end
-- Note: Overrides base class GetIsJumping with get-and-clear behavior to do a single jump
-- rather than sustained jumping. This is only to preserve the current behavior through the refactor.


function DynamicThumbstick:GetIsJumping()
	local wasJumping = self.isJumping
	self.isJumping = false
	return wasJumping
end

function DynamicThumbstick:Enable(enable: boolean?, uiParentFrame): boolean
	if enable == nil then return false end			-- If nil, return false (invalid argument)
	enable = enable and true or false				-- Force anything non-nil to boolean before comparison
	if self.enabled == enable then return true end	-- If no state change, return true indicating already in requested state

	if enable then
		-- Enable
		if not self.thumbstickFrame then
			self:Create(uiParentFrame)
		end

		self:BindContextActions()
	else
		ContextActionService:UnbindAction(DYNAMIC_THUMBSTICK_ACTION_NAME)
		-- Disable
		self:OnInputEnded() -- Cleanup
	end

	self.enabled = enable
	self.thumbstickFrame.Visible = enable
end
-- Compiled with roblox-ts v2.0.4
-- eslint-disable-next-line @typescript-eslint/no-empty-interface


local unitMeta = {}
unitMeta.__eq = function()
	return true
end
unitMeta.__tostring = function()
	return "()"
end
unitMeta.__index = function()
	return error("Attempt to index Unit", 2)
end
local function unit()
	return setmetatable({}, unitMeta)
end
return {
	unit = unit,
}
-------------------------


function onClicked()
R.Function1.Disabled = true
FX.CRUSH.BrickColor = BrickColor.new("Really red")
FX.CRUSH.loop.Disabled = true

FX.HPF.BrickColor = BrickColor.new("Really red")
FX.HPF.loop.Disabled = true

FX.LPF.BrickColor = BrickColor.new("Really red")
FX.LPF.loop.Disabled = true

FX.NOISE.BrickColor = BrickColor.new("Really red")
FX.NOISE.loop.Disabled = true

FX.ZIP.BrickColor = BrickColor.new("Really red")
FX.ZIP.loop.Disabled = true
R.loop.Disabled = false
R.Function2.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- 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.1, 0.4, -0.2) -- Change these to change the positiones of your hat, as I said earlier.
		wait(5)		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)