Roblox/luau_corpus huggingface dataset:
--[[
	ROBLOX deviation: ReactSharedInternals captures singleton state across the
	whole workspace. This file and the modules it requires were moved from React
	to untangle a cyclic workspace member dependency.

	Before:
	* ReactSharedInternals (and the 5 associated modules) lived in React
	* React had a dependency on Shared
	* Shared reached into React source to re-export ReactSharedInternals (cycle)

	After:
	* ReactSharedInternals (and the 5 associated modules) live in Shared
	* React depends on Shared
	* Shared has no intra-workspace dependencies (no cycles)
]]
local Packages = script.Parent.Parent
local console = require(Packages.LuauPolyfill).console
local function onlyInTestError(functionName: string)
	return function()
		console.error(functionName .. " is only available in tests, not in production")
	end
end
-- Gradually regenerates the Humanoid's Health over time. FOTPS

local REGEN_RATE = 20 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 0.1 -- Wait this long between each regeneration step.
-- REQUIRED PARTS -----------------------------------------------
-- Include all of these, or things will break!
local headlights = {
	model.Headlight_Left,
	model.Headlight_Right
}
local brakelights = {
	model.Brakelight_Left,
	model.Brakelight_Right
}
local seat = model.VehicleSeat -- Your driver seat
local upVectorPart = model.VehicleSeatBack -- Any part with lookvector up (we use this when you get flipped over)
local gyro = upVectorPart.BodyGyro  -- Point this to any unused bodyGyro.
local smoke = model.ExhaustPipe.Smoke
local fire = model.ExhaustPipe.Fire
-- Handle potential Premium purchase from outside the game while user is playing
Players.PlayerMembershipChanged:Connect(function(player)
	warn("Player membership changed; new membership is " .. tostring(player.MembershipType))
	if player.MembershipType == Enum.MembershipType.Premium then
		-- Teleport player to the Premium-only place
-- Requires - Module Functions
ServerSceneFramework.LoadCharacterRemoteEventModule = require(script.LoadCharacterRemoteEventModule)
ServerSceneFramework.LoadSceneModule = require(script.LoadSceneModule)
ServerSceneFramework.FinishedLoadingClientModule = require(script.FinishedLoadingClientModule)
ServerSceneFramework.LoadSceneFromListEventModule = require(script.LoadSceneFromListEventModule)
ServerSceneFramework.GetCurrentSceneEnvironmentModule = require(script.GetCurrentSceneEnvironmentModule)
ServerSceneFramework.IsLoadingSceneModule = require(script.IsLoadingSceneModule)
ServerSceneFramework.LoadSceneServerModule = require(script.LoadSceneServerModule)
ServerSceneFramework.OnPlayerAddedModule = require(script.OnPlayerAddedModule)
ServerSceneFramework.CheckFolderForLoadedScenesModule = require(script.CheckFolderForLoadedScenesModule)
ServerSceneFramework.FindClientFolderModule = require(script.FindClientFolderModule)
ServerSceneFramework.FindServerFolderModule = require(script.FindServerFolderModule)
ServerSceneFramework.InitModule = require(script.InitModule)
ServerSceneFramework.HandleOrchestrateEvent = require(script.HandleOrchestrateEvent)

local Orchestra = script.Parent
--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 1000		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6200		--		Use sliders to manipulate values
	Tune.Redline		= 7700		--		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	= 1.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)
--[[**
	Returns a t.union of each key in the table as a t.literal

	@param keyTable The table to get keys from

	@returns True iff the condition is satisfied, false otherwise
**--]]
function t.keyOf(keyTable)
	local keys = {}
	local length = 0
	for key in keyTable do
		length = length + 1
		keys[length] = key
	end

	return t.literal(table.unpack(keys, 1, length))
end
--// Servc
local UIS = game:GetService('UserInputService')
local Players = game:GetService('Players')
local SSS = game:GetService('ServerScriptService')
local rp = game:GetService("ReplicatedStorage")
--bp.Position = shelly.PrimaryPart.Position
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end


local soundBank = game.ReplicatedStorage.Sounds.NPC.Shelly:GetChildren()

shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = tick()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()

repeat task.wait() until tick()-ostrich > 10
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)


while true do
if shellyGood then
MoveShelly()
else
task.wait(1)
end 
end
-- Do not edit these values, they are not the developer-set limits, they are limits
-- to the values the camera system equations can correctly handle
local MIN_ALLOWED_ELEVATION_DEG = -80
local MAX_ALLOWED_ELEVATION_DEG = 80

local externalProperties = {}
externalProperties["InitialDistance"] 	= 25
externalProperties["MinDistance"] 		= 10
externalProperties["MaxDistance"] 		= 100
externalProperties["InitialElevation"] 	= 35
externalProperties["MinElevation"] 		= 35
externalProperties["MaxElevation"] 		= 35
externalProperties["ReferenceAzimuth"] 	= -45	-- Angle around the Y axis where the camera starts. -45 offsets the camera in the -X and +Z directions equally
externalProperties["CWAzimuthTravel"] 	= 90	-- How many degrees the camera is allowed to rotate from the reference position, CW as seen from above
externalProperties["CCWAzimuthTravel"] 	= 90	-- How many degrees the camera is allowed to rotate from the reference position, CCW as seen from above
externalProperties["UseAzimuthLimits"] 	= false -- Full rotation around Y axis available by default

local Util = require(script.Parent:WaitForChild("CameraUtils"))
-- ================================================================================
-- Settings - Tachyon
-- ================================================================================

local Settings = {}

Settings.DefaultSpeed = 200		-- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 300		-- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 6		-- Duration of boost in seconds
Settings.Steering = 8			-- How quickly the speeder turns [Range: 1-10]
--[[
	Constructs a new Promise with the given initializing callback.

	This is generally only called when directly wrapping a non-promise API into
	a promise-based version.

	The callback will receive 'resolve' and 'reject' methods, used to start
	invoking the promise chain.

	Second parameter, parent, is used internally for tracking the "parent" in a
	promise chain. External code shouldn't need to worry about this.
]]
function Promise._new(traceback, callback, parent)
	if parent ~= nil and not Promise.is(parent) then
		error("Argument #2 to Promise.new must be a promise or nil", 2)
	end

	local self = {
		-- Used to locate where a promise was created
		_source = traceback,

		_status = Promise.Status.Started,

		-- A table containing a list of all results, whether success or failure.
		-- Only valid if _status is set to something besides Started
		_values = nil,

		-- Lua doesn't like sparse arrays very much, so we explicitly store the
		-- length of _values to handle middle nils.
		_valuesLength = -1,

		-- Tracks if this Promise has no error observers..
		_unhandledRejection = true,

		-- Queues representing functions we should invoke when we update!
		_queuedResolve = {},
		_queuedReject = {},
		_queuedFinally = {},

		-- The function to run when/if this promise is cancelled.
		_cancellationHook = nil,

		-- The "parent" of this promise in a promise chain. Required for
		-- cancellation propagation upstream.
		_parent = parent,

		-- Consumers are Promises that have chained onto this one.
		-- We track them for cancellation propagation downstream.
		_consumers = setmetatable({}, MODE_KEY_METATABLE),
	}

	if parent and parent._status == Promise.Status.Started then
		parent._consumers[self] = true
	end

	setmetatable(self, Promise)

	local function resolve(...)
		self:_resolve(...)
	end

	local function reject(...)
		self:_reject(...)
	end

	local function onCancel(cancellationHook)
		if cancellationHook then
			if self._status == Promise.Status.Cancelled then
				cancellationHook()
			else
				self._cancellationHook = cancellationHook
			end
		end

		return self._status == Promise.Status.Cancelled
	end

	coroutine.wrap(function()
		local ok, _, result = runExecutor(
			self._source,
			callback,
			resolve,
			reject,
			onCancel
		)

		if not ok then
			reject(result[1])
		end
	end)()

	return self
end

function Promise.new(executor)
	return Promise._new(debug.traceback(nil, 2), executor)
end

function Promise:__tostring()
	return string.format("Promise(%s)", self._status)
end
--script.Parent.KK.Velocity = script.Parent.KK.CFrame.lookVector *script.Parent.Speed.Value
--script.Parent.KKK.Velocity = script.Parent.KKK.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.KKKK.Velocity = script.Parent.KKKK.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.L.Velocity = script.Parent.L.CFrame.lookVector *script.Parent.Speed.Value
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


function Scale()
	local magnitude = GrabMagnitude()
	
	--- Don't run this if we don't need to (resolution hasn't changed much)
	if (not magnitude) or (lastMagnitude and math.abs(lastMagnitude - magnitude) < differenceToScan) or (lastMagnitude and lastMagnitude >= bestResolution and magnitude >= bestResolution) then
		return
	end
	lastMagnitude = magnitude
	
	--- Calculate ratio
	local ratio = maxDownscale + ((math.min(magnitude, bestResolution) / bestResolution) * (1 - maxDownscale))
	
	
	--- Change 9Slices
	for _, gui in ipairs(_L.Player.Get("PlayerGui"):GetChildren()) do
		if gui.ClassName == "ScreenGui" and (not _L.Functions.SearchArray(blacklist, gui.Name)) then
			for i, v in ipairs(gui:GetDescendants()) do
				--- Yield to prevent microstuttering for lots of gui elements
				if i%200 == 0 then
					wait()
				end
				
				--- Adjust 9slice scaling ratio based on resolution
				if (v.ClassName == "ImageLabel" or v.ClassName == "ImageButton") and v.ScaleType == Enum.ScaleType.Slice then
					if not archive[v] then
						archive[v] = v.SliceScale
					end
					local base = archive[v]
					v.SliceScale = base * ratio
				end
			end
		end
	end
end


function GrabMagnitude()
	local resolution = _L.Player.Get("Camera").ViewportSize
	if resolution then
		local magnitude = resolution.Magnitude
		return magnitude
	end
end
--This is just some simple server script that moves the object around every frame
--The kinematics module handles the rest


game["Run Service"].Heartbeat:Connect(function(deltaTime)
	
	local speed = script:GetAttribute("speed") or Vector3.zero
	total+=deltaTime
	part.CFrame = startPos * CFrame.fromEulerAngles(total*speed.x,total*speed.y,total*speed.z)
end)
-- ROBLOX deviation: we change from backtick to our literal string delimiter [=[ and ]=]
local function printBacktickString(str: string): string
	return "[=[\n" .. str .. "]=]"
end

local function ensureDirectoryExists(filePath: string)
	-- ROBLOX deviation: gets path of parent directory, GetScriptFilePath can only be called on ModuleScripts
	local pathComponents = filePath:split("/")
	pathComponents = table.pack(table.unpack(pathComponents, 1, #pathComponents - 1))
	local path = table.concat(pathComponents, "/")
	local ok, err = pcall(function()
		if not FileSystemService:Exists(path) then
			FileSystemService:CreateDirectories(path)
		end
	end)

	if not ok and err:find("Error%(13%): Access Denied%. Path is outside of sandbox%.") then
		error(
			"Provided path is invalid: you likely need to provide a different argument to --fs.readwrite.\n"
				.. "You may need to pass in `--fs.readwrite=$PWD`"
		)
	end
end

function normalizeNewLines(string_: string)
	string_ = string.gsub(string_, "\r\n", "\n")
	local result = string.gsub(string_, "\r", "\n")
	return result
end
--[[Wheel Stabilizer Gyro]]
	Tune.FGyroDamp		= 400		-- Front Wheel Non-Axial Dampening
	Tune.RGyroDamp		= 400		-- Rear Wheel Non-Axial Dampening
-- wrapping long conditional in function
local function isShiftLockMode()
	return LocalPlayer.DevEnableMouseLock and GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch and
			LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.ClickToMove and
			GameSettings.ComputerMovementMode ~= Enum.ComputerMovementMode.ClickToMove and
			LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.Scriptable and
			not UserInputService.GamepadEnabled
end

if not UserInputService.TouchEnabled then	-- TODO: Remove when safe on mobile
	IsShiftLockMode = isShiftLockMode()
end
-- Clear any existing animation tracks
-- Fixes issue with characters that are moved in and out of the Workspace accumulating tracks
local animator = if Humanoid then Humanoid:FindFirstChildOfClass("Animator") else nil
if animator then
	local animTracks = animator:GetPlayingAnimationTracks()
	for i,track in ipairs(animTracks) do
		track:Stop(0)
		track:Destroy()
	end
end

for name, fileList in pairs(animNames) do
	configureAnimationSet(name, fileList)
end
for _,child in script:GetChildren() do
	if child:isA("StringValue") then
		animNames[child.Name] = {}
		configureAnimationSet(child.Name, animNames[child.Name])
	end
end
-- ROBLOX TODO: fix PrettyFormat types imports
-- local PrettyFormat = require(Packages.PrettyFormat)
local PrettyFormat = require(CurrentModule.PrettyFormat)
type PrettyFormatOptions = PrettyFormat.OptionsReceived

local utils = require(CurrentModule.utils)
local addExtraLineBreaks = utils.addExtraLineBreaks
local getSnapshotData = utils.getSnapshotData
local keyToTestName = utils.keyToTestName
local removeExtraLineBreaks = utils.removeExtraLineBreaks
--[ MAIN LOCALS ]-

local Player = game.Players.LocalPlayer
local Event = game.ReplicatedStorage.MusicEvents.NewSong
local Frame = script.Parent.Parent
local Gui = game.StarterGui.SurfaceGui.SongPart.Frame.SongName
local SongText = Gui.Text
local sound = game.Workspace.Sound
local label = script.Parent.Parent.Requester
--local TwoHandAnim = hammer:WaitForChild("TwoHandAnim")

hammer.Equipped:Connect(function()
	local character = hammer.Parent
	if Players:GetPlayerFromCharacter(character) and character:FindFirstChild("Humanoid") then
		--character.Humanoid.Animator:LoadAnimation(TwoHandAnim):Play()
		end
end)


hammer.Activated:Connect(function()
	local character = hammer.Parent
	if db == false and Players:GetPlayerFromCharacter(character) and character:FindFirstChild("Humanoid") then

		--character.Humanoid.Animator:LoadAnimation(Slash):Play() -- Plays the animation

		local touchFunction
		touchFunction = hammer.Handle.Touched:Connect(function(hit) -- Fires when the hammer is touched
			local hitCharacter = hit:FindFirstAncestorOfClass("Model") -- The character we hit
			local hitPlayer = Players:GetPlayerFromCharacter(hitCharacter) -- Player we it
			local banSound = script.Parent.Handle.ban
			if hit and hitCharacter and hitPlayer then -- if we hit a player
				--banSave:SetAsync(hitPlayer.UserId,true) -- Saves the ban (Don't do this if you only want to kick them)
				hitPlayer:Kick("Congratulations! You just got kicked by the ban hammer! Be lucky you didn't banned instead!") -- Kicks with the provided message
				banSound:Play()
				touchFunction:Disconnect() -- Ends the function
			end
		end)

		db = true -- Enables cooldown
		task.wait(1) -- You might need to adjust this
		touchFunction:Disconnect()
		task.wait(1-0.3) -- The cooldown
		db = false -- Disables cooldown

	end
end)
--[=[
	@type ExtensionFn (component) -> ()
	@within Component
]=]
type ExtensionFn = (any) -> ()
--local RecipesFrame = InventoryFrame.Recipes;

local Sizes = {
	
	[ItemsFrame] = {
		[EquipButton] = {
			Size = ItemsFrame.Size;
			Position = ItemsFrame.Position;
		};
		[CraftButton] = {
			Size = UDim2.new(0,-427,1,-155);
			Position = ItemsFrame.Position;
		};
		[RecycleButton] = {
			Size = UDim2.new(0,-427,1,-200);
			Position = ItemsFrame.Position;
		};
	};
	
	[ActionsFrame] = {
		[EquipButton] = {
			Size = ActionsFrame.Size;
			Position = ActionsFrame.Position;
		};
		[CraftButton] = {
			Size = UDim2.new(1,0,0,160);
			Position = UDim2.new(0,0,1,-160);
		};
		[RecycleButton] = {
			Size = UDim2.new(1,0,0,205);
			Position = UDim2.new(0,0,1,-205);
		};
	};
	
	[EquippedFrame] = {
		[EquipButton] = {
			Size = EquippedFrame.Size;
			Position = EquippedFrame.Position;
		};
		[CraftButton] = {
			Size = UDim2.new(0,130,1,-155);
			Position = UDim2.new(1,0,0,0);
		};
		[RecycleButton] = {
			Size = UDim2.new(0,130,1,-200);
			Position = EquippedFrame.Position;
		};
	};
	
	--[[[RecipesFrame] = {
		[EquipButton] = {
			Size = RecipesFrame.Size;
			Position = RecipesFrame.Position;
		};
		[CraftButton] = {
			Size = UDim2.new(0,292,1,-155);
			Position = RecipesFrame.Position; --EquippedFrame.Position;
		};
		[RecycleButton] = {
			Size = UDim2.new(0,0,1,-200);
			Position = ItemsFrame.Position;
		};
	};]]
	
};
--[[setmetatable(
    PriorityQueue,
    {
        __call = function (self)
            setmetatable({}, self)
            self:initialize()
            return self
        end
    }
)]]

function PriorityQueue.new()
	local queueData = {}
	setmetatable(queueData,PriorityQueue)
	
	 queueData:initialize()

	return queueData
end


function PriorityQueue:initialize()
    --[[  Initialization.
    Example:
        PriorityQueue = require("priority_queue")
        pq = PriorityQueue()
    ]]--
    self.heap = {}
    self.current_size = 0
end

function PriorityQueue:empty()
    return self.current_size == 0
end

function PriorityQueue:size()
    return self.current_size
end

function PriorityQueue:swim()
    -- Swim up on the tree and fix the order heap property.
    local heap = self.heap
    local floor = floor
    local i = self.current_size

    while floor(i / 2) > 0 do
        local half = floor(i / 2)
        if heap[i][2] < heap[half][2] then
            heap[i], heap[half] = heap[half], heap[i]
        end
        i = half
    end
end

function PriorityQueue:push(v, p)
    --[[ Put an item on the queue.
    Args:
        v: the item to be stored
        p(number): the priority of the item
    ]]--
    --

    self.heap[self.current_size + 1] = {v, p}
    self.current_size = self.current_size + 1
    self:swim()
end

function PriorityQueue:sink()
    -- Sink down on the tree and fix the order heap property.
    local size = self.current_size
    local heap = self.heap
    local i = 1

    while (i * 2) <= size do
        local mc = self:min_child(i)
        if heap[i][2] > heap[mc][2] then
            heap[i], heap[mc] = heap[mc], heap[i]
        end
        i = mc
    end
end

function PriorityQueue:min_child(i)
    if (i * 2) + 1 > self.current_size then
        return i * 2
    else
        if self.heap[i * 2][2] < self.heap[i * 2 + 1][2] then
            return i * 2
        else
            return i * 2 + 1
        end
    end
end

function PriorityQueue:pop()
    -- Remove and return the top priority item
    local heap = self.heap
    local retval = heap[1][1]
    heap[1] = heap[self.current_size]
    heap[self.current_size] = nil
    self.current_size = self.current_size - 1
    self:sink()
    return retval
end

return PriorityQueue
--[[
	@class stringTween
	contains library of functions that add/remove text from a string.
	
	.backward:
		@params: string, function, string?, config?
     	@info: clears text or until hit `StopAt`		
	
	.forward: 
		@params: string, string, function, config?
		@info: adds `newText` to the given string

	```lua
		local stringTween = require(container.stringTween)

		local startText = 'person'
		local newText = 'son'
		local stopAt = 'per'		

		local predicate = function(text)
			startText = text
		end

		stringTween.backward(startText, predicate, stopAt) > returns per
		stringTween.forward(startText, newText, predicate) > returns person
	```
]]

local stringTween = {}

function stringTween.forward(
	s: string, 
	apply: string, 
	predicate: (string) -> (), 
	config: config?
)
	if config then
		config.delay = config.delay or defaultconfig.delay
		config.movement = config.movement or defaultconfig.movement
	end

	local config = config or defaultconfig
	local result
	
	for i = 0, #apply, 1 do
		result = `{s}{string.sub(apply, 1, i)}{config.movement}`
		
		predicate(result)
		
		task.wait(config.delay)
	end
	
	result = result:sub(1, #result - #config.movement)
	predicate(result)
	
	return result
end

function stringTween.backward(
	s: string, 
	predicate: (string) -> (), 
	breakat: string?, 
	config: config?
)
	if config then
		config.delay = config.delay or defaultconfig.delay
		config.movement = config.movement or defaultconfig.movement
	end
	
	local config = config or defaultconfig
	local result
	
	for i = #s, 0, -1 do
		result = `{string.sub(s, 1, i)}{config.movement}`
		predicate(result)
		
		if breakat and string.sub(result, 1, -1) == `{breakat}{config.movement}` then
			break 
		end
		task.wait(config.delay)
	end
	
	result = string.sub(result, 1, #result - #config.movement)
	predicate(result)
	
	return result
end

return stringTween
--[[Weight and CG]]
	Tune.Weight			= 3590		-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		6		,
	 --[[Height]]		3.5		,
	 --[[Length]]		14		}
	Tune.WeightDist		= 50		-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
	Tune.CGHeight		= .8		-- Center of gravity height (studs relative to median of all wheels)
	Tune.WBVisible		= false		-- Makes the weight brick visible
	
	--Unsprung Weight
	Tune.FWheelDensity	= .1		-- Front Wheel Density
	Tune.RWheelDensity	= .1		-- Rear Wheel Density
	Tune.FWLgcyDensity	= 1			-- Front Wheel Density [PGS OFF]
	Tune.RWLgcyDensity	= 1			-- Rear Wheel Density [PGS OFF]
	
	Tune.AxleSize		= 2			-- Size of structural members (larger = more stable/carry more weight)
	Tune.AxleDensity	= .1		-- Density of structural members