Roblox/luau_corpus huggingface dataset:
--[[

	Component.Auto(folder: Instance)
		-> Create components automatically from descendant modules of this folder
		-> Each module must have a '.Tag' string property
		-> Each module optionally can have '.RenderPriority' number property

	component = Component.FromTag(tag: string)
		-> Retrieves an existing component from the tag name

	Component.ObserveFromTag(tag: string, observer: (component: Component, janitor: Janitor) -> void): Janitor

	component = Component.new(tag: string, class: table [, renderPriority: RenderPriority, requireComponents: {string}])
		-> Creates a new component from the tag name, class module, and optional render priority

	component:GetAll(): ComponentInstance[]
	component:GetFromInstance(instance: Instance): ComponentInstance | nil
	component:GetFromID(id: number): ComponentInstance | nil
	component:Filter(filterFunc: (comp: ComponentInstance) -> boolean): ComponentInstance[]
	component:WaitFor(instanceOrName: Instance | string [, timeout: number = 60]): Promise<ComponentInstance>
	component:Observe(instance: Instance, observer: (component: ComponentInstance, janitor: Janitor) -> void): Janitor
	component:Destroy()

	component.Added(obj: ComponentInstance)
	component.Removed(obj: ComponentInstance)

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

	A component class must look something like this:

		-- DEFINE
		local MyComponent = {}
		MyComponent.__index = MyComponent

		-- CONSTRUCTOR
		function MyComponent.new(instance)
			local self = setmetatable({}, MyComponent)
			return self
		end

		-- FIELDS AFTER CONSTRUCTOR COMPLETES
		MyComponent.Instance: Instance

		-- OPTIONAL LIFECYCLE HOOKS
		function MyComponent:Init() end                     -> Called right after constructor
		function MyComponent:Deinit() end                   -> Called right before deconstructor
		function MyComponent:HeartbeatUpdate(dt) ... end    -> Updates every heartbeat
		function MyComponent:SteppedUpdate(dt) ... end      -> Updates every physics step
		function MyComponent:RenderUpdate(dt) ... end       -> Updates every render step

		-- DESTRUCTOR
		function MyComponent:Destroy()
		end


	A component is then registered like so:

		local Component = require(Knit.Util.Component)
		local MyComponent = require(somewhere.MyComponent)
		local tag = "MyComponent"

		local myComponent = Component.new(tag, MyComponent)


	Components can be listened and queried:

		myComponent.Added:Connect(function(instanceOfComponent)
			-- New MyComponent constructed
		end)

		myComponent.Removed:Connect(function(instanceOfComponent)
			-- New MyComponent deconstructed
		end)

--]]


local Janitor = require(script.Parent.Janitor)
local Signal = require(script.Parent.Signal)
local Promise = require(script.Parent.Promise)
local TableUtil = require(script.Parent.TableUtil)
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local IS_SERVER = RunService:IsServer()
local DEFAULT_WAIT_FOR_TIMEOUT = 60
local ATTRIBUTE_ID_NAME = "ComponentServerId"
----------------------------------
------------VARIABLES-------------
----------------------------------

User = nil

Connector = game.Workspace:FindFirstChild("GlobalPianoConnector")
if not Connector or not Connector:IsA("RemoteEvent") then
	error("The piano requires a RemoteEvent named GlobalPianoConnector to be in Workspace.")
end
local TweenService = game:GetService("TweenService")
function Tween(obj,Goal,Time,Wait,...) local TwInfo = TweenInfo.new(Time,...) local twn = TweenService:Create(obj, TwInfo, Goal) twn:Play() if Wait then twn.Completed:wait() end return
end
for i,v in pairs(Piano.Keys.Keys:GetChildren()) do
	v.Transparency = 1
end
--|| Services ||--
local RunService = game:GetService("RunService")

local TaskScheduler = {}
local Cache = {}
local SteppedConnection = nil

local function OnStepped()
	if #Cache == 0 then 
		SteppedConnection = SteppedConnection and SteppedConnection:Disconnect() 
	end

	for Index, Queue in next, Cache do
		if os.clock() - Queue[2] >= Queue[1] then
			local Callback = Queue[3];
			table.remove(Cache, Index);
			Callback();
			break
		end
	end
end

function TaskScheduler:AddTask(Duration, Callback)

	if SteppedConnection == nil then
		SteppedConnection = RunService.Stepped:Connect(OnStepped)
	end

	Duration = Duration or 0
	Callback = Callback or function() print("Empty Callback Function") end

	--| Sort 
	local CacheSize = #Cache
	Cache[CacheSize + 1] = {Duration, os.clock(), Callback}
end

return TaskScheduler
------------------------------------------------------------------------
--
-- * used in luaK:prefix(), luaK:posfix()
------------------------------------------------------------------------
function luaK:codearith(fs, op, e1, e2)
  if self:constfolding(op, e1, e2) then
    return
  else
    local o2 = (op ~= "OP_UNM" and op ~= "OP_LEN") and self:exp2RK(fs, e2) or 0
    local o1 = self:exp2RK(fs, e1)
    if o1 > o2 then
      self:freeexp(fs, e1)
      self:freeexp(fs, e2)
    else
      self:freeexp(fs, e2)
      self:freeexp(fs, e1)
    end
    e1.info = self:codeABC(fs, op, 0, o1, o2)
    e1.k = "VRELOCABLE"
  end
end
-- Gets a random number between 1 and 4, each number
-- corrosponding with the Pos number.
BlockPosition = math.random(1,2)
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
local function setActive(args)
	local active = false
	if #args >= 1 then
		active = args[1]
	else
		return
	end

	if not active then
		-- Hide racing GUIs
		local PlayerGui = player.PlayerGui
		local TopBar = PlayerGui:FindFirstChild("TopBar")
		TopBar.Enabled = false
	end
end -- setActive

local function checkpointEvent(args)
	for _, arg in pairs(args) do
		if arg[1] == "setActive" then
			table.remove(arg, 1)
			setActive(arg)
		end
	end
end -- checkpointEvent()
-------------------------
--| Exposed Functions |--
-------------------------

function PopperCam:Update()
	if PopperEnabled then
		-- First, prep some intermediate vars
		local focusPoint = Camera.Focus.p
		local cameraCFrame = Camera.CoordinateFrame
		local cameraFrontPoint = cameraCFrame.p + (cameraCFrame.lookVector * NEAR_CLIP_PLANE_OFFSET)
		local screenSize = Camera.ViewportSize
		local ignoreList = {game.Workspace:WaitForChild("Debris")}
		if Camera and Camera.CameraSubject and Camera.CameraSubject.Parent then
		table.insert(ignoreList, Camera.CameraSubject.Parent)
		end
		for _, character in pairs(PlayerCharacters) do
			table.insert(ignoreList, character)
		end
		for _, basePart in pairs(VehicleParts) do
			table.insert(ignoreList, basePart)
		end
		
		-- Cast rays at the near clip plane, from corresponding points near the focus point,
		-- and find the direct line that is the most cut off
		local largest = 0
		for _, screenScale in pairs(CAST_SCREEN_SCALES) do
			local clipWorldPoint = ScreenToWorld(screenSize * screenScale, screenSize, NEAR_CLIP_PLANE_OFFSET)
			local rayStartPoint = focusPoint + (clipWorldPoint - cameraFrontPoint)
			local _, hitPoint = PiercingCast(rayStartPoint, clipWorldPoint, ignoreList)
			local cutoffAmount = (hitPoint - clipWorldPoint).Magnitude
			if cutoffAmount > largest then
				largest = cutoffAmount
			end
		end
		
		-- Then check if the player zoomed since the last frame,
		-- and if so, reset our pop history so we stop tweening
		local zoomLevel = (cameraCFrame.p - focusPoint).Magnitude
		if math.abs(zoomLevel - LastZoomLevel) > 0.001 then
			LastPopAmount = 0
		end
		
		-- Finally, zoom the camera in (pop) by that most-cut-off amount, or the last pop amount if that's more
		local popAmount = math.max(largest, LastPopAmount)
		if popAmount > 0 then
			Camera.CoordinateFrame = cameraCFrame + (cameraCFrame.lookVector * popAmount)
			LastPopAmount = math.max(0, popAmount - POP_RESTORE_RATE) -- Shrink it for the next frame
		end
		
		LastZoomLevel = zoomLevel
	end
end
--------END RIGHT DOOR --------

repeat
if game.Workspace.DoorFlashing.Value == true then
--[[
	Function called when leaving the state
]]
function PlayerGame.onLeave(stateMachine, serverPlayer, event, from, to)
	for _, connection in pairs(connections) do
		connection:Disconnect()
	end
end

return PlayerGame
-- Sounds
maid.gunFireSound = maid.instance.Weapon.Handle:FindFirstChild("Fire")
-- ProductId 1218011852 for 250 Cash
developerProductFunctions[Config.DeveloperProductIds["250 Cash"]] = function(receipt, player)
	-- Logic/code for player buying 250 Cash (may vary)
	local leaderstats = player:FindFirstChild("leaderstats")
	local cash = leaderstats and leaderstats:FindFirstChild("Cash")
	if cash then
		if Utilities:OwnsGamepass(player, gamepassID) then
			cash.Value += 500
		else
			cash.Value += 250
		end
		-- Indicate a successful purchase
		return true
	end
end
-- Decompiled with the Synapse X Luau decompiler.

return {
	Name = "history", 
	Aliases = {}, 
	AutoExec = { "alias \"!|Displays previous command from history.\" run ${history $1{number|Line Number}}", "alias \"^|Runs the previous command, replacing all occurrences of A with B.\" run ${run replace ${history -1} $1{string|A} $2{string|B}}", "alias \"!!|Reruns the last command.\" ! -1" }, 
	Description = "Displays previous commands from history.", 
	Group = "DefaultUtil", 
	Args = { {
			Type = "integer", 
			Name = "Line Number", 
			Description = "Command line number (can be negative to go from end)"
		} }, 
	ClientRun = function(p1, p2)
		local v1 = p1.Dispatcher:GetHistory();
		if p2 <= 0 then
			p2 = #v1 + p2;
		end;
		return v1[p2] and "";
	end
};
--//Services//--
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
--[=[
	Like then, but the value passed down the chain is the resolved value of the promise, not
	the value returned from onFulfilled or onRejected

	Will still yield for the result if a promise is returned, but will discard the result.

	@param onFulfilled function
	@param onRejected function
	@return Promise<T> -- Returns self
]=]
function Promise:Tap(onFulfilled, onRejected)
	-- Run immediately like then, but we return something safer!
	local result = self:Then(onFulfilled, onRejected)
	if result == self then
		return result
	end

	-- Most of the time we can just return the same
	-- promise. But sometimes we need to yield
	-- for the result to finish, and then resolve that result to a new result
	if result._fulfilled then
		return self
	elseif result._rejected then
		return self
	elseif result._pendingExecuteList then
		-- Definitely the most expensive case, might be able to make this better over time
		local function returnSelf()
			return self
		end

		return result:Then(returnSelf, returnSelf)
	else
		error("Bad result state")
	end
end
---------------------------------------------------------------
function onChildAdded(child)
	if child.Name == "SeatWeld" then
		local human = child.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			print("Human IN")
			seat.SirenControl.Control.CarName.Value = human.Parent.Name.."s Car"
			s.Parent.SirenControl:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
			s.Parent.RDetector:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
			seat.Start:Play()
			wait(1)
			seat.Start:Stop()
			seat.Engine:Play()
		end
	end
end

function onChildRemoved(child)
	if (child.Name == "SeatWeld") then	
		local human = child.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			print("Human OUT")
			seat.SirenControl.Control.CarName.Value = "Empty Car"
			game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenControl:remove()
			game.Players:findFirstChild(human.Parent.Name).PlayerGui.RDetector:remove()
			seat.Engine:Stop()
		end
	end
end


script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
-- Map DataStoreService methods to associated RequestTypes:
local requestTypes = {
	GetAsync = Enum.DataStoreRequestType.GetAsync;
	SetAsync = Enum.DataStoreRequestType.SetIncrementAsync;
	RemoveAsync = Enum.DataStoreRequestType.SetIncrementAsync;
	OnUpdate = Enum.DataStoreRequestType.OnUpdate;
	IncrementAsync = Enum.DataStoreRequestType.SetIncrementAsync;
}


local function GetBudget(method)
	return dataStoreService:GetRequestBudgetForRequestType(requestTypes[method])
end


function SafeDataStore.new(name, scope)
	
	local self = setmetatable({
		DataStore = dataStoreService:GetDataStore(name, scope);
	}, SafeDataStore)

	self.Failed = self.Shared.Event.new()
	
	return self
	
end


function SafeDataStore:Try(method, k, v)
	local budget = GetBudget(method)
	if (budget == 0) then
		-- Do something in later implementation
	end
	local value = nil
	for i = 1,MAX_ATTEMPTS do
		local success,v = pcall(function()
			return self.DataStore[method](self.DataStore, k, v)
		end)
		if (success) then
			value = v
			break
		elseif (i == MAX_ATTEMPTS) then
			warn("DataStore " .. method .. " failed: " .. tostring(v))
			self.Failed:Fire(method, k, tostring(v))
		else
			wait(ATTEMPT_INTERVAL)
		end
	end
	return value
end


function SafeDataStore:OnUpdate(key, callback)
	return self.DataStore:OnUpdate(key, callback)
end


function SafeDataStore:GetAsync(key)
	return self:Try("GetAsync", key)
end


function SafeDataStore:IncrementAsync(key, delta)
	return self:Try("IncrementAsync", key, delta)
end


function SafeDataStore:SetAsync(key, value)
	return self:Try("SetAsync", key, value)
end


function SafeDataStore:RemoveAsync(key)
	return self:Try("RemoveAsync", key)
end


function SafeDataStore:UpdateAsync(key, transformFunction)
	return self:Try("UpdateAsync", key, transformFunction)
end


return SafeDataStore
--[[Weld functions]]

	local PGS_ON = workspace:PGSIsEnabled()
	if not PGS_ON then
		error("A-Chassis no longer supports Legacy physics solving, sorry!")
	end
	
	function MakeWeld(x,y,type,s) 
		if type==nil then type="Weld" end
		local W=Instance.new(type,x) 
		W.Part0=x W.Part1=y 
		W.C0=x.CFrame:inverse()*x.CFrame 
		W.C1=y.CFrame:inverse()*x.CFrame 
		if type=="Motor" and s~=nil then 
			W.MaxVelocity=s 
		end 
		return W	
	end
	
	function ModelWeld(a,b) 
		if a:IsA("BasePart") then 
			MakeWeld(b,a,"Weld") 
		elseif a:IsA("Model") then 
			for i,v in pairs(a:GetChildren()) do 
				ModelWeld(v,b) 
			end 
		end 
	end
	
	function UnAnchor(a) 
		if a:IsA("BasePart") then a.Anchored=false  end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end 
	end
-- Set Pet Canvas Size --
module.SetPetCanvasSize = function()
	local PADDING,SIZE,MaxCells = getSizes()
	local AbsoluteSize = ScrollingFrame.AbsoluteSize

    local NewPadding = PADDING * AbsoluteSize
    NewPadding = UDim2.new(0, NewPadding .X, 0, NewPadding .Y)
    local NewSize = SIZE * AbsoluteSize
    NewSize = UDim2.new(0, NewSize.X, 0, NewSize.Y)

    UIGridLayout.CellPadding = NewPadding
    UIGridLayout.CellSize = NewSize

	local items = ScrollingFrame:GetChildren()
	local frameSizeY = ScrollingFrame.AbsoluteSize.Y
	local ySize = UIGridLayout.CellSize.Y.Offset
	local yPadding = UIGridLayout.CellPadding.Y.Offset
	UIGridLayout.FillDirectionMaxCells = MaxCells
	local rows = math.ceil((#items-1)/UIGridLayout.FillDirectionMaxCells)
	local pixels = rows*ySize + (rows-1)*yPadding
	ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, (pixels + 5))
end

function module:Int()
	game:GetService("Workspace").CurrentCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
		delay(.5, function() module.SetPetCanvasSize() end)
	end)
end

return module
--returns the four corners with the highest y components
--this is to catch when a user has flipped the baseplate upside down
function RoomPackager:TopCornersOfBasePlate(basePlate)
	local corners = self:CornersOfPart(basePlate)
	local centerY = basePlate.Position.Y
	local topCorners = {}
	for _, corner in pairs(corners) do
		--if a corner is higher globally than the center of the part, then
		--it is along the top-facing surface of the part
		if corner.Y > centerY then
			table.insert(topCorners, corner)
		end
	end
	return topCorners
end
--- Takes in raw command information and generates a command out of it.
-- text and executor are required arguments.
-- allowIncompleteData, when true, will ignore errors about arguments missing so we can parse live as the user types.
-- data is for special networked Data about the command gathered on the client. Purely Optional.
-- returns the command if successful, or (false, errorText) if not
function Dispatcher:Evaluate (text, executor, allowIncompleteArguments, data)
	if RunService:IsClient() == true and executor ~= Players.LocalPlayer then
		error("Can't evaluate a command that isn't sent by the local player.")
	end

	local arguments = Util.SplitString(text)
	local commandName = table.remove(arguments, 1)
	local commandObject = self.Registry:GetCommand(commandName)

	if commandObject then
		-- No need to continue splitting when there are no more arguments. We'll just mash any additional arguments into the last one.
		arguments = Util.MashExcessArguments(arguments, #commandObject.Args)

		-- Create the CommandContext and parse it.
		local command = Command.new({
			Dispatcher = self,
			Text = text,
			CommandObject = commandObject,
			Alias = commandName,
			Executor = executor,
			Arguments = arguments,
			Data = data
		})
		local success, errorText = command:Parse(allowIncompleteArguments)

		if success then
			return command
		else
			return false, errorText
		end
	else
		return false, ("%q is not a valid command name. Use the help command to see all available commands."):format(tostring(commandName))
	end
end
---[[ Chat Behaviour Settings ]]
module.WindowDraggable = false
module.WindowResizable = true
module.ShowChannelsBar = true
module.GamepadNavigationEnabled = false
module.AllowMeCommand = false -- Me Command will only be effective when this set to true
module.ShowUserOwnFilteredMessage = true	--Show a user the filtered version of their message rather than the original.
-- Hide the frame when the animation completes
tween.Completed:Connect(function()
	frame.Visible = false
end)
--script.Parent = game.ServerScriptService
local DevProducts = {}
local GamePasses = {}
local MarketplaceService = game:GetService('MarketplaceService')

for i,v in pairs(Tycoon:WaitForChild('Buttons'):GetChildren()) do
	if v:FindFirstChild('DevProduct') then
		if v.DevProduct.Value > 0 then
			DevProducts[v.DevProduct.Value] = v -- the button
		end
	end
end
--[[**
	ensures Roblox CFrame type

	@param value The value to check against

	@returns True iff the condition is satisfied, false otherwise
**--]]
t.CFrame = t.typeof("CFrame")
--]]


function getHumanoid(model)
	for _, v in pairs(model:GetChildren()) do
		if v:IsA'Humanoid' then
			return v
		end
	end
end


local zombie = script.Parent
local human = getHumanoid(zombie)
local hroot = zombie.HumanoidRootPart
local zspeed = hroot.Velocity.magnitude


local pfs = game:GetService("PathfindingService")

function GetPlayerNames()
	local players = game:GetService('Players'):GetChildren()
	local name = nil
	for _, v in pairs(players) do
		if v:IsA'Player' then
			name = tostring(v.Name)
		end
	end
	return name
end

spawn(function()
	while wait() do

	end
end)

function GetPlayersBodyParts(t)
	local torso = t
	if torso then
		local figure = torso.Parent
		for _, v in pairs(figure:GetChildren()) do
			if v:IsA'Part' then
				return v.Name
			end
		end
	else
		return "HumanoidRootPart"
	end
end

function GetTorso(part)
	local chars = game.Workspace:GetChildren()
	local torso = nil
	for _, v in pairs(chars) do
		if v:IsA'Model' and v ~= script.Parent then
			if v:FindFirstChild("HumanoidRootPart") then
			local charRoot = v:FindFirstChild("HumanoidRootPart")
			if (charRoot.Position - part).magnitude < SearchDistance then
				torso = charRoot
				Ragdoll.Parent = torso.Parent
				Ragdoll.Disabled = false
			elseif not v:FindFirstChild("HumanoidRootPart") then		
			if v:FindFirstChild("Torso") then
			local charRoot = v:FindFirstChild("Torso")
			if (charRoot.Position - part).magnitude < SearchDistance then
			torso = charRoot
			Ragdoll.Parent = torso.Parent
			Ragdoll.Disabled = false	
						end
					end		
				end	
		    end
		end
	end
	return torso
end

for _, zambieparts in pairs(zombie:GetChildren()) do
	if zambieparts:IsA'Part' and zambieparts.Parent:FindFirstChildOfClass("Humanoid") then
		zambieparts.Touched:connect(function(p)
			if not p.Parent:FindFirstChildOfClass("Humanoid") then
			elseif p.Parent:FindFirstChildOfClass("Humanoid").Health == 0 then
			elseif p.Parent.Name ~= zombie.Name and p.Parent:FindFirstChildOfClass("Humanoid").Health > 0  then -- damage
			local enemy = p.Parent
			local enemyhuman = getHumanoid(enemy)
			enemyhuman:TakeDamage(ZombieDamage)	
			print("ded")		
			hroot.Death:Play()			
			wait(6)	
			hroot.Death:Stop()			
			end
		end)
	end
end
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.SpeedPotion -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)