Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- places a brick at pos and returns the position of the brick's opposite corner


function placeBrick(cf, pos, color)
	local brick = Instance.new("Part")
	brick.BrickColor = color
	brick.Name='Pushbox'
	brick.CFrame = cf * CFrame.new(pos + brick.Size / 2)
	script.Parent.BrickCleanup:Clone().Parent = brick -- attach cleanup script to this brick
	brick.BrickCleanup.Disabled = false
	brick.Parent = game.Workspace
	brick:MakeJoints()
	return  brick, pos +  brick.Size
end

function buildWall(cf)

	local color = BrickColor.Random()
	local bricks = {}

	assert(wallWidth>0)
	local y = 0
	while y < wallHeight do
		local p
		local x = -wallWidth/2
		while x < wallWidth/2 do
			local brick
			brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
			x = p.x
			table.insert(bricks, brick)
			wait(brickSpeed)
		end
		y = p.y
	end

	return bricks

end


function snap(v)
	if math.abs(v.x)>math.abs(v.z) then
		if v.x>0 then
			return Vector3.new(1,0,0)
		else
			return Vector3.new(-1,0,0)
		end
	else
		if v.z>0 then
			return Vector3.new(0,0,1)
		else
			return Vector3.new(0,0,-1)
		end
	end
end


Tool.Enabled = true
function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if not humanoid then
		return 
	end

	local targetPos = MouseLoc:InvokeClient(game:GetService("Players"):GetPlayerFromCharacter(character))
	local lookAt = snap( (targetPos - character.Head.Position).unit )
	local cf = CFrame.new(targetPos, targetPos + lookAt)

	Tool.Handle.BuildSound:Play()

	buildWall(cf)

	wait(5)

	Tool.Enabled = true
end

Tool.Activated:Connect(onActivated)
--[[ The Module ]]

--
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local DynamicThumbstick = setmetatable({}, BaseCharacterController)
DynamicThumbstick.__index = DynamicThumbstick

function DynamicThumbstick.new()
	local self = setmetatable(BaseCharacterController.new(), DynamicThumbstick)

	self.humanoid = nil

	self.tools = {}
	self.toolEquipped = nil

	self.revertAutoJumpEnabledToFalse = false

	self.moveTouchObject = nil
	self.moveTouchStartPosition = nil

	self.startImage = nil
	self.endImage = nil
	self.middleImages = {}

	self.startImageFadeTween = nil
	self.endImageFadeTween = nil
	self.middleImageFadeTweens = {}

	self.isFirstTouch = true

	self.isFollowStick = false
	self.thumbstickFrame = nil
	self.onTouchMovedConn = nil
	self.onTouchEndedConn = nil
	self.onTouchActivateConn = nil
	self.onRenderSteppedConn = nil

	self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
	self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
	self.hasFadedBackgroundInPortrait = false
	self.hasFadedBackgroundInLandscape = false

	self.tweenInAlphaStart = nil
	self.tweenOutAlphaStart = nil

	-- If this module changes a player's humanoid's AutoJumpEnabled, it saves
	-- the previous state in this variable to revert to
	self.shouldRevertAutoJumpOnDisable = false

	return self
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.KittyBow -- 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)
-- Game Variables


GameSettings.intermissionDuration = 10
GameSettings.roundDuration = 60
GameSettings.minimumPlayers = 1
GameSettings.transitionStart = 3
GameSettings.transitionEnd = 3
GameSettings.pointValues = {
	 -- Value types must match folder names to award points correctly
	LowPoints = 0,
	MediumPoints = 10,
	HighPoints = 15,
}
GameSettings.roundWalkSpeed = 10
GameSettings.mapName = "Arena"

return GameSettings
--[=[
	Pipes the tranformers through each other
	https://rxjs-dev.firebaseapp.com/api/index/function/pipe

	@param transformers { Observable<any> }
	@return (source: Observable<T>) -> Observable<U>
]=]


function Rx.pipe(transformers)
	assert(type(transformers) == "table", "Bad transformers")
	for index, transformer in pairs(transformers) do
		if type(transformer) ~= "function" then
			error(("[Rx.pipe] Bad pipe value of type %q at index %q, expected function")
				:format(type(transformer), tostring(index)))
		end
	end

	return function(source)
		assert(source, "Bad source")

		local current = source
		for key, transformer in pairs(transformers) do
			current = transformer(current)

			if not (type(current) == "table" and current.ClassName == "Observable") then
				error(("[Rx.pipe] - Failed to transform %q in pipe, made %q (%s)")
					:format(tostring(key), tostring(current), tostring(type(current) == "table" and current.ClassName or "")))
			end
		end

		return current
	end
end
--[[
	
	local Damping = require(this)
	
	local damping = Damping.new()
	
	damping.P = NUMBER
	damping.D = NUMBER
	damping.Position = Vector3
	damping.Goal = Vector3
	
	damping:Update()      [Returns Vector3 position]
	damping:UpdateAngle() [Returns Vector3 position, but each XYZ value is wrapped properly for pi*2 motion]
	
	
	
	EXAMPLE USE:
	
	-- Set D and P values:
	damping.P = 5
	damping.D = 0.1
	
	-- Set starting position:
	damping.Position = part.Position
	
	while (true) do
	
		wait()
		
		-- Update the goal:
		damping.Goal = mouse.Hit.p
		
		-- Calculate new position:
		local newPosition = damping:Update()
		part.Position = newPosition
		
	end
	
	
	
	ALGORITHM:
		
		velocity += P * ( (target - current) + D * -velocity );
		current += velocity * dt;
		
		Credit: http://www.gamedev.net/topic/561981-smooth-value-damping/
	
	
--]]




local Damping = {}
Damping.__index = Damping

local V3 = Vector3.new
local PI = math.pi
local TAU = PI * 2
local tick = tick


local function CheckNAN(value, returnIfNan)
	return (value == value and value or returnIfNan)
end


local function DeltaAngle(current, target)
	local num = (target - current) % TAU
	return (num > PI and (num - TAU) or num)
end


local function DeltaAngleV3(pos1, pos2)
	return V3(
		DeltaAngle(pos1.X, pos2.X),
		DeltaAngle(pos1.Y, pos2.Y),
		DeltaAngle(pos1.Z, pos2.Z)
	)
end


function Damping.new()
	
	local damping = setmetatable({
		P = 5;
		D = 0.1;
		Position = V3();
		Velocity = V3();
		Goal = V3();
		Last = tick();
	}, Damping)
	
	return damping
	
end


function Damping:CheckNAN()
	self.Velocity = V3(CheckNAN(self.Velocity.X, 0), CheckNAN(self.Velocity.Y, 0), CheckNAN(self.Velocity.Z, 0))
	self.Position = V3(CheckNAN(self.Position.X, self.Goal.X), CheckNAN(self.Position.Y, self.Goal.Y), CheckNAN(self.Position.Z, self.Goal.Z))
end


function Damping:Update()
	local t = tick()
	local dt = (t - self.Last)
	self.Last = t
	self.Velocity = (self.Velocity + (self.P * ((self.Goal - self.Position) + (-self.Velocity * self.D))))
	self.Position = (self.Position + (self.Velocity * dt))
	self:CheckNAN()
	return self.Position
end


function Damping:UpdateAngle()
	self.Goal = (self.Position + DeltaAngleV3(self.Position, self.Goal))
	return self:Update()
end


return Damping
---------------------------------------------


local alreadythrown=false

local HoldAnim, ThrowAnim;
function UUU()
	if script.Parent.Anim.Value==false then
if alreadythrown then 
	return
end
	if game.Workspace.Preparation.Value==true then return end
	if script.Parent.Enabled==false then return end

HoldAnim:Play()

script.Parent.Anim.Value=true
end
end

function THROW(short)
if game.Workspace.Preparation.Value==true then return end
		if script.Parent.Enabled==false then return end
			if script.Parent.Anim.Value==true  then
				if alreadythrown then
				return
				end
				alreadythrown=true
		--we track the reload time like this so that the player can't fire faster with
		--rapid dis / re-equipping, which will actually be common usage with this gear.
					HoldAnim:Stop(0)
				if short and short==true then
				local dent=Instance.new("IntValue")
				dent.Parent=script.Parent
				dent.Name="Short"
				end
			script.Parent.Anim.Value=false
			
			ThrowAnim:Play(0,1,1)
			script.Parent.Handle.Throw:Play()
			wait(0.2)
			--
			script.Parent.SpawnGrenade:FireServer(game.Players.LocalPlayer.Character.Head.CFrame,game.Players.LocalPlayer.Character.Humanoid.TargetPoint,short)
			


end
end
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local idle=game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent:WaitForChild("Idle"))
Tool.Equipped:connect(function(mouse)
	local button1=false
local button2=false
	idle:Play()
	Character = Tool.Parent
	Player = game.Players:GetPlayerFromCharacter(Character)

	local HoldAnimSrc = WaitFor(Tool).HoldAnim()
	HoldAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743592'
	local ThrowAnimSrc = WaitFor(Tool).ThrowAnim()
	ThrowAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743566'

	HoldAnim = Character.Humanoid:LoadAnimation(HoldAnimSrc)
	ThrowAnim = Character.Humanoid:LoadAnimation(ThrowAnimSrc)
script.Parent.Enabled=false
wait(0.6)
script.Parent.Enabled=true
	--setup first anim / cursor cycle
mouse.Button1Down:connect(function()
	button1=true
UUU()
end)
mouse.Button2Down:connect(function()
	button2=true
UUU()
end)
	mouse.Button1Up:connect(function()
button1=false
if button1==false and button2==false then
		THROW(false)
		end
	end)
	mouse.Button2Up:connect(function()
button2=false
if button1==false and button2==false then
		THROW(true)
		end
end)
end)
Tool.Unequipped:connect(function()

	script.Parent.Anim.Value=false
	if idle then
		idle:Stop()
	end
	script.Parent.Anim.Value=false
	if ThrowAnim then
		ThrowAnim:Stop()
	end
	if HoldAnim then
		HoldAnim:Stop()
	end
end)
---------------
-- Variables --
---------------



local PlayersService = game:GetService('Players')
local Player = PlayersService.LocalPlayer
local PlayerMouse = Player:GetMouse()

local Camera = nil
local CameraChangeConn = nil

local PlayerCharacters = {} -- For ignoring in raycasts
local VehicleParts = {} -- Also just for ignoring

local LastPopAmount = 0
local LastZoomLevel = 0
--[[
while true do
	x=20
	y=20	
	for x=20,60 do
		me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
		wait(0.1)			
	end
	x=60
	for y=20,60 do
		me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
		wait(0.1)			
	end
	y=60
	for x=60,20,-1 do
		me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
		wait(0.1)			
	end
	x=20
	for y=60,20,-1 do
		me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
		wait(0.1)			
	end
end	

print("end")
]]

--
-------------------
-- Adonis Server --
-------------------
--!nocheck


																																																																																						  --[[
This module is part of Adonis 1.0 and contains lots of old code;
future updates will generally only be made to fix bugs, typos or functionality-affecting problems.

If you find bugs or similar issues, please submit an issue report
on our GitHub repository here: https://github.com/Epix-Incorporated/Adonis/issues/new/choose
																																																																																						]]
--[[Evt.Ombro.OnClientEvent:Connect(function(Nome)
	TextoOmbro.Text = Nome .." tapped your shoulder!"
	TextoOmbro.TextTransparency = 0
	TextoOmbro.TextStrokeTransparency = 0
	TS:Create(TextoOmbro, TweenInfo.new(5), {TextTransparency = 1,TextStrokeTransparency = 1} ):Play()
end)]]
--[=[
	An event emitter that emits the instance that was actually created. This is
	useful for a variety of things.

	Using this to track an instance

	```lua
	local currentCamera = Blend.State()

	return Blend.New "ViewportFrame" {
		CurrentCamera = currentCamera;
		[Blend.Children] = {
			self._current;
			Blend.New "Camera" {
				[Blend.Instance] = currentCamera;
			};
		};
	};
	```

	Note that since 6.14 you should also be able to just use the reification scheme of
	[Blend.Children] implicitly in [Blend.mount] to get somewhat equivalent behavior.

	```lua
	Blend.mount(frame, {
		-- Array indexed methods get treated as children-constructors, which get the parent
		-- in them;

		function(parent)
			print("Got parent!", parent)
		end;
	})
	```

	You can also use this to execute code against an instance.

	```lua
	return Blend.New "Frame" {
		[Blend.Instance] = function(frame)
			print("We got a new frame!")
		end;
	};
	```

	Note that if you subscribe twice to the resulting observable, the internal function
	will execute twice.

	@param parent Instance
	@return Observable<Instance>
]=]


function Blend.Instance(parent)
	return Observable.new(function(sub)
		sub:Fire(parent)
	end)
end
--[[
	Creates a new binding from this one with the given mapping.
]]


function bindingPrototype:map(valueTransform)
	if config.typeChecks then
		assert(typeof(valueTransform) == "function", "Bad arg #1 to binding:map: expected function")
	end

	local binding = Binding.create(valueTransform(self:getValue()))

	binding[InternalData].valueTransform = valueTransform
	binding[InternalData].upstreamBinding = self

	return binding
end
-- This function is called when a player joins the game


function onPlayerJoin(player)
	 -- Generate a new secret for the player
	generateSecret()
	 
	 -- Send the player a message with their secret
	 player:SendMessage("Welcome to the game! You have been given a secret that you must not say in the chat. If you do, you will be kicked from the game. Your secret is: " .. secret)
end
--[=[
	Completes all subscriptions and removes them from the list.
]=]


function ObservableSubscriptionTable:Destroy()
	while next(self._subMap) do
		local key, list = next(self._subMap)
		self._subMap[key] = nil

		for _, sub in pairs(list) do
			if sub:IsPending() then
				task.spawn(function()
					sub:Complete()
				end)
			end
		end
	end
end


return ObservableSubscriptionTable
-- Variables (best not to touch these!)


local button = script.Parent 
local car = script.Parent.Parent.Car.Value
local sound = script.Parent.Start
local sound1 = script.Parent.Start1
sound.Parent = car.DriveSeat -- What brick the start sound is playing from.
button.MouseButton1Click:connect(function() -- Event when the button is clicked
	if script.Parent.Text == "Engine: Off" then -- If the text says it's off then..
		sound:Play()
		wait(2) -- For realism. Okay?
		script.Parent.Parent.IsOn.Value = true -- The car is is on, or in other words, start up the car.
		sound1:Play()
		wait (0.2)
		sound:Stop()
		button.Text = "Engine: On"-- You don't really need this, but I would keep it.
	else -- If it's on then when you click the button,
		script.Parent.Parent.IsOn.Value = false -- The car is turned off.
		button.Text = "Engine: Off"
	end -- Don't touch this.
end) -- And don't touch this either.
--[[ Derived classes are required to override and implement all of the following functions ]]

--
function BaseOcclusion:GetOcclusionMode(): Enum.DevCameraOcclusionMode?
	-- Must be overridden in derived classes to return an Enum.DevCameraOcclusionMode value
	warn("BaseOcclusion GetOcclusionMode must be overridden by derived classes")
	return nil
end

function BaseOcclusion:Enable(enabled: boolean)
	warn("BaseOcclusion Enable must be overridden by derived classes")
end

function BaseOcclusion:Update(dt: number, desiredCameraCFrame: CFrame, desiredCameraFocus: CFrame)
	warn("BaseOcclusion Update must be overridden by derived classes")
	return desiredCameraCFrame, desiredCameraFocus
end

return BaseOcclusion
--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.Noodle -- 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)
--if tool then
--	local handle = tool:FindFirstChild("Handle")
--	local toolCopy = tool:Clone()
--	toolCopy.Parent = game.ServerStorage
--	local toolOnPad = true
--
--	local parentConnection
--	parentConnection = tool.AncestryChanged:connect(function()
--		if handle then handle.Anchored = false end
--		toolOnPad = false
--		parentConnection:disconnect()
--	end)
--
--	if handle then
--		handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
--		handle.Anchored = true
--	end
--
--	while true do
--		while toolOnPad do
--			if handle then
--				handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
--			end
--			wait()
--		end
--		wait(configs["SpawnCooldown"])
--		local newTool = toolCopy:Clone()
--		newTool.Parent = game.Workspace
--		handle = newTool:FindFirstChild("Handle")
--		toolOnPad = true
--	end
--end
-- Do not edit the below.



script.Parent.Changed:connect(function(child)
SingleDriverMode = script.Parent.DSL.Value
 if SingleDriverMode == true then
     if script.Parent.Occupant ~= nil then
         if script.Parent.Occupant.Parent.Name ~= AllowedDriver then
         script.Parent.Occupant.Jump = true
         script.Parent.Occupant.Health = 0
     else end
 end
 else
  for i,v in pairs(Blacklist) do
   if script.Parent.Occupant ~= nil then
          if script.Parent.Occupant.Parent.Name == Blacklist[i] then
           if script.Parent.Occupant.Parent.Name ~= AllowedDriver then
     script.Parent.Occupant.Jump = true
           script.Parent.Occupant.Health = 0
     end
      else end
   end
  end
 end
end)
-- The names of the frames in the Attribute frame correspond to stat names



function UpdateAttributes()
	script.Parent:WaitForChild("Points").Text = "Points: " .. players.LocalPlayer.Stats.Points.Value
	for _,attribute in pairs(attributes:GetChildren()) do
		if attribute.ClassName == "Frame" then
			local cap = replicatedStorage.ServerSettings:FindFirstChild(attribute.Name .. "Cap")
			local stat = players.LocalPlayer.Attributes:FindFirstChild(attribute.Name)
			local percentage = 1
			if cap and stat then
				percentage = stat.Value / cap.Value
			end
			attribute.Bar.Fill.Position = UDim2.new(percentage - 1, 0, 0, 0)
			attribute.Title.Text = attribute.Name .. " (" .. stat.Value .. ")"
		end
	end
end

script.Parent:WaitForChild("Reset").MouseButton1Click:Connect(function()
	require(playSoundEffect)("Unequip")
	workspace.Remotes.ResetPoints:InvokeServer()
	UpdateAttributes()
end)

script.Parent:WaitForChild("Close").MouseButton1Click:Connect(function()
	require(switchMenu)(true)
end)

script.Parent:GetPropertyChangedSignal("Visible"):Connect(function()
	if script.Parent.Visible == true then
		UpdateAttributes()
	end
end)

for _,attribute in pairs(attributes:GetChildren()) do
	if attribute.ClassName == "Frame" then
		attribute:WaitForChild("Add").MouseButton1Click:Connect(function()
			local success = workspace.Remotes.UsePointForAttribute:InvokeServer(attribute.Name)
			if success then
				require(playSoundEffect)("Equip")
				UpdateAttributes()
			end
		end)
	end
end
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================


local function exit()
	ContextActionService:UnbindAction("ExitSpeeder")
	
	local raceStatus = RaceManager:GetRaceStatus()
	if raceStatus == RaceManager.Status.WaitingForPlayers or 
		raceStatus == RaceManager.Status.WaitingForRaceToStart then
		RemoveActivePlayer:FireServer()
	else
		PlayerConverter:SpeederToPlayer()
	end
end -- exit()
--[=[
	Repeatedly calls a Promise-returning function up to `times` number of times, until the returned Promise resolves.

	If the amount of retries is exceeded, the function will return the latest rejected Promise.

	```lua
	local function canFail(a, b, c)
		return Promise.new(function(resolve, reject)
			-- do something that can fail

			local failed, thing = doSomethingThatCanFail(a, b, c)

			if failed then
				reject("it failed")
			else
				resolve(thing)
			end
		end)
	end

	local MAX_RETRIES = 10
	local value = Promise.retry(canFail, MAX_RETRIES, "foo", "bar", "baz") -- args to send to canFail
	```

	@since 3.0.0
	@param callback (...: P) -> Promise<T>
	@param times number
	@param ...? P
]=]


function Promise.retry(callback, times, ...)
	assert(isCallable(callback), "Parameter #1 to Promise.retry must be a function")
	assert(type(times) == "number", "Parameter #2 to Promise.retry must be a number")

	local args, length = { ... }, select("#", ...)

	return Promise.resolve(callback(...)):catch(function(...)
		if times > 0 then
			return Promise.retry(callback, times - 1, unpack(args, 1, length))
		else
			return Promise.reject(...)
		end
	end)
end
--[[
    onChatAnimationPlayed(animationId: string, triggerWord: string): RBXScriptSignal

    This client event is fired every time the "chat emotes" feature plays an animation in response to a chat message being
    sent by the local player. It passes down both the ID of the animation that was activated and the corresponding trigger
    word that was detected in the message.
--]]



SocialInteractions.onChatAnimationPlayed:Connect(function(animationId, triggerWord)
	print("Chat animation was played", animationId, triggerWord)
end)