Roblox/luau_corpus huggingface dataset:
-- js  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
-- lua http://www.lua.org/manual/5.4/manual.html#pdf-utf8.codepoint
return function(str: string, index: number): number
	if typeof(index) ~= "number" then
		index = 1
	end

	local strLen, invalidBytePosition = utf8.len(str)
	assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition)))
	if index > strLen or index < 1 then
		return NaN
	end

	local offset = utf8.offset(str, index)
	local value = utf8.codepoint(str, offset, offset)

	if value == nil then
		return NaN
	end

	return value
end
-- Types
-- Stephen Leitnick
-- December 20, 2021


export type Args = {
	n: number,
	[any]: any,
}

export type FnBind = (Instance, ...any) -> ...any

export type ServerMiddlewareFn = (Instance, Args) -> (boolean, ...any)
export type ServerMiddleware = {ServerMiddlewareFn}

export type ClientMiddlewareFn = (Args) -> (boolean, ...any)
export type ClientMiddleware = {ClientMiddlewareFn}

return nil
---
local  Paint = false
	
script.Parent.MouseButton1Click:connect(function()
	Paint = not Paint
	handler:FireServer("Tawny",Paint)
end)
--[=[
	Honestly, I have not used this one much.

	https://rxjs-dev.firebaseapp.com/api/operators/withLatestFrom
	https://medium.com/js-in-action/rxjs-nosy-combinelatest-vs-selfish-withlatestfrom-a957e1af42bf

	@param inputObservables {Observable<TInput>}
	@return (source: Observable<T>) -> Observable<{T, ...TInput}>
]=]
function Rx.withLatestFrom(inputObservables)
	assert(inputObservables, "Bad inputObservables")

	for _, observable in pairs(inputObservables) do
		assert(Observable.isObservable(observable), "Bad observable")
	end

	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

		return Observable.new(function(sub)
			local maid = Maid.new()

			local latest = {}

			for key, observable in pairs(inputObservables) do
				latest[key] = UNSET_VALUE

				maid:GiveTask(observable:Subscribe(function(value)
					latest[key] = value
				end, nil, nil))
			end

			maid:GiveTask(source:Subscribe(function(value)
				for _, item in pairs(latest) do
					if item == UNSET_VALUE then
						return
					end
				end

				sub:Fire({value, unpack(latest)})
			end, sub:GetFailComplete()))

			return maid
		end)
	end
end
-- Implements Javascript's `Object.is` as defined below
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
return function(value1: any, value2: any): boolean
	if value1 == value2 then
		return value1 ~= 0 or 1 / value1 == 1 / value2
	else
		return value1 ~= value1 and value2 ~= value2
	end
end
--[[ Local functionality ]]--

local function isDynamicThumbstickEnabled()
	return ThumbstickFrame and ThumbstickFrame.Visible
end

local function enableAutoJump(humanoid)
	if humanoid and isDynamicThumbstickEnabled() then
		local shouldRevert = humanoid.AutoJumpEnabled == false
		shouldRevert = shouldRevert and LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice
		RevertAutoJumpEnabledToFalse = shouldRevert
		humanoid.AutoJumpEnabled = true
	end
end

do
	local function onCharacterAdded(character)	
		
		for _, child in ipairs(LocalPlayer.Character:GetChildren()) do
			if child:IsA("Tool") then
				IsAToolEquipped = true
			end
		end
		character.ChildAdded:Connect(function(child)
			if child:IsA("Tool") then
				IsAToolEquipped = true
			elseif child:IsA("Humanoid") then
				enableAutoJump(child)
			end
		end)
		character.ChildRemoved:Connect(function(child)
			if child:IsA("Tool") then
				IsAToolEquipped = false
			end
		end)
		
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			enableAutoJump(humanoid)
		end
	end
	LocalPlayer.CharacterAdded:Connect(onCharacterAdded)
	if LocalPlayer.Character then
		onCharacterAdded(LocalPlayer.Character)
	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)
	return plrData.Classes.Super.Viper.Obtained.Value == true and plrData.Classes.Super.Viper.Scourge.Value == true and plrData.Classes.Super.Viper.HiddenViper.Value == true
end
--> Main

local function UpdateHeatBar()
	heatBar.Visible = heldGunHeat.Value > 0.025

	heatBar.Heat.Size = UDim2.new(heldGunHeat.Value,0,1,0)
end

local function SetupGUIForHeldGun(gun)
	for i,image in ipairs(images:GetChildren()) do
		if image.Name == gun.Name then
			image.ImageTransparency = 0
		else
			image.ImageTransparency = 1
		end
	end
	
	heldGunHeat = gun:WaitForChild("Heat")
	
	if heatConnection then
		heatConnection:Disconnect()
	end
	UpdateHeatBar()
	heatConnection = heldGunHeat.Changed:Connect(function(property)
		UpdateHeatBar()
	end)
end

local function SetupGUIForHeldMelee(melee)
	for i,image in ipairs(images:GetChildren()) do
		if image.Name == melee.Name then
			image.ImageTransparency = 0
		else
			image.ImageTransparency = 1
		end
	end
	
	heatBar.Visible = false
	if heatConnection then
		heatConnection:Disconnect()
	end
end
-- Hook up ShopRegion parts to open and close the merch booth
local TAG_NAME = "ShopRegion"
local DEBOUNCE_TIME = 1
local lastClose = 0
function hookupRegionPart(regionPart)
	regionPart.Touched:Connect(function(otherPart)
		
		-- Debounce the shop from opening too soon after being closed
		if os.clock() < lastClose + DEBOUNCE_TIME then
			return
		end
		
		local character = Players.LocalPlayer.Character
		if character and character:FindFirstChild("HumanoidRootPart") == otherPart then
			MerchBooth.openMerchBooth()
		end
	end)

	regionPart.TouchEnded:Connect(function(otherPart)
		local character = Players.LocalPlayer.Character
		if character and character:FindFirstChild("HumanoidRootPart") == otherPart then
			lastClose = os.clock()
			MerchBooth.closeMerchBooth()
		end
	end)
end

for _, regionPart in ipairs(CollectionService:GetTagged(TAG_NAME)) do
	hookupRegionPart(regionPart)
end
CollectionService:GetInstanceAddedSignal(TAG_NAME):connect(hookupRegionPart)
--[[Transmission]]
	Tune.TransModes		= {"Auto", "Semi"}								--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "Manual"}								
		>First mode is default mode													]]
	
	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)
	
	--Gear Ratios
	Tune.FinalDrive		= 3.16			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	4.40		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		3.53		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.04		,
		--[[ 3 ]]		1.38		,
		--[[ 4 ]]		1.03		,
		--[[ 5 ]]		0.81		,
		--[[ 6 ]]		0.64		,
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
-------------------------
function onClicked()
R.Function1.Disabled = true
FX.CRUSH.BrickColor = BrickColor.new("Really red")
FX.CRUSH.loop.Disabled = true

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

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

FX.HPF.BrickColor = BrickColor.new("Really red")
FX.HPF.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)
--[[Run]]

	--Print Version
	local ver=require(car["A-Chassis Tune"].README)
	print("//INSPARE: AC6 Loaded - Build "..ver)
	
	--Runtime Loops
	
	-- ~60 c/s
	game["Run Service"].Stepped:connect(function()
		--Steering
		Steering()
		
		--RPM
		RPM()
		
		--Update External Values
		_IsOn = script.Parent.IsOn.Value
		_InControls = script.Parent.ControlsOpen.Value
		script.Parent.Values.Gear.Value = _CGear
		script.Parent.Values.RPM.Value = _RPM
		script.Parent.Values.Horsepower.Value = _HP
		script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
		script.Parent.Values.TransmissionMode.Value = _TMode
		script.Parent.Values.Throttle.Value = _GThrot
		script.Parent.Values.Brake.Value = _GBrake
		script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
		script.Parent.Values.SteerT.Value = _GSteerT
		script.Parent.Values.PBrake.Value = _PBrake
		script.Parent.Values.TCS.Value = _TCS
		script.Parent.Values.TCSActive.Value = _TCSActive
		script.Parent.Values.ABS.Value = _ABS
		script.Parent.Values.ABSActive.Value = _ABSActive
		script.Parent.Values.MouseSteerOn.Value = _MSteer
		script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
	end)
	
	-- ~15 c/s
	while wait(.0667) do
		--Power
		Engine()
		
		--Flip
		if _Tune.AutoFlip then Flip() end
		if Stats.Fuel.Value <= 0 then _IsOn = false end
		
	end
--[=[
	Retrieves the manager
	@return PlayerDataStoreManager
]=]
function PlayerDataStoreService:PromiseManager()
	if self._dataStoreManagerPromise then
		return self._dataStoreManagerPromise
	end

	self._dataStoreManagerPromise = self._started
		:Then(function()
			return DataStorePromises.promiseDataStore(self._dataStoreName, self._dataStoreScope)
		end)
		:Then(function(dataStore)
			local manager = PlayerDataStoreManager.new(
				dataStore,
				function(player)
					return tostring(player.UserId)
				end)
			self._maid:GiveTask(manager)
			return manager
		end)

	return self._dataStoreManagerPromise
end

return PlayerDataStoreService
----------------------------------
------------FUNCTIONS-------------
----------------------------------

function IsBlack(note)
	if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then
		return true
	end
end
function HighlightPianoKey(note1)
	if not Settings.KeyAesthetics then return end
	--print("highlight!")
	local octave = math.ceil(note1/12)
	local note2 = (note1 - 1)%12 + 1
	local key = Keys[octave][note2]
	if IsBlack(note1) then
		key.Mesh.Offset = Vector3.new(0.02, -0.15, 0)
	else
		key.Mesh.Offset = Vector3.new(0, -.05, 0)
	end
	delay(.5, function() RestorePianoKey(note1) end)
end
function RestorePianoKey(note1)
	local octave = math.ceil(note1/12)
	local note2 = (note1 - 1)%12 + 1
	local key = Keys[octave][note2]
	if IsBlack(note1) then
		key.Mesh.Offset = Vector3.new(0.02, -0.1, 0)
	else
		key.Mesh.Offset = Vector3.new(0, 0, 0)
	end
end
--ColourRand ---------------------------------------------

script.Parent.Configuration.ColorRand.Changed:connect(function()
while script.Parent.Configuration.ColorRand.Value == 1 do
		wait(0.1)

r = math.random(1,255)/255
g = math.random(1,255)/255
b = math.random(1,255)/255
script.Parent.Configuration.Colour.Value = Color3.new(r,g,b)



end	
	


end)
--You can change the values below to suit your needs

local max_mode = 10 --The maximum amount of modes forwards. Set to 0 to disable forwards motion.

local min_mode = -10 --The minimum amount of modes backwards. Set to 0 to disable backwards motion.

local increment_speed = 0.4 --The amount in which the speed value increments with every mode.
--[[
	Wait in parallel for all RemoteEvents and RemoteFunctions defined in RemoteNames to
	replicate into the remoteFolder.

	Used to ensure all remotes exist before the client Network module finishes initializing.
--]]

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Sift = require(ReplicatedStorage.Dependencies.Sift)
local RemoteEventName = require(ReplicatedStorage.Source.Network.RemoteName.RemoteEventName)
local RemoteFunctionName = require(ReplicatedStorage.Source.Network.RemoteName.RemoteFunctionName)
local RemoteFolderName = require(ReplicatedStorage.Source.Network.RemoteFolderName)

local function waitForAllRemotesAsync(remoteFolder: Instance, timeoutSeconds: number)
	-- Using FindFirstChild to satisfy the type checker
	local remoteEventsFolder = remoteFolder:FindFirstChild(RemoteFolderName.RemoteEvents) :: Folder
	local remoteFunctionsFolder = remoteFolder:FindFirstChild(RemoteFolderName.RemoteFunctions) :: Folder

	-- We are casting these constants tables to any for type compatibility with Sift
	local remoteEvents: { string } = Sift.Dictionary.values(RemoteEventName :: any)
	local remoteFunctions: { string } = Sift.Dictionary.values(RemoteFunctionName :: any)

	-- Validate that the remotes defined under RemoteNames exist in remote folders
	local success = true
	local function search(names: { string }, folder: Folder)
		for _, remoteName in ipairs(names) do
			local remote = folder:WaitForChild(remoteName, timeoutSeconds)
			if not remote then
				success = false
				break
			end
		end
	end

	search(remoteEvents, remoteEventsFolder)
	search(remoteFunctions, remoteFunctionsFolder)

	assert(success, "Network could not find all remotes. Did the client Network module initialize before the server?")
end

return waitForAllRemotesAsync
--[[
AnimateKey(note1,px,py,pz,ox,oy,oz,Time)
--note1(1-61), position x, position y, position z, orientation x, orientation y, orientation z, time

local obj = --object or gui or wahtever goes here
local Properties = {}
Properties.Size = UDim2.new()
Tween(obj,Properties,2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
--Obj,Property,Time,wait,Easingstyle,EasingDirection,RepeatAmt,Reverse
]]
local vars = {}
for i = 1,61 do
	vars[i] = false
end
function HighlightPianoKey(note1,transpose)
	if not Settings.KeyAesthetics then return end
	local octave = math.ceil(note1/12)
	local note2 = (note1 - 1)%12 + 1
	local key = Piano.Keys.Keys:FindFirstChild(note1)
	if key then
		if IsBlack(note1) then
			key.Color = Color3.fromRGB(229, 91, 188)
			key.ParticleEmitter.Color = ColorSequence.new({ColorSequenceKeypoint.new( 0, Color3.fromRGB(229, 91, 188)),ColorSequenceKeypoint.new( 1, Color3.fromRGB(229, 91, 188))})
		else
			key.Color = Color3.fromRGB(229, 117, 214)
			key.ParticleEmitter.Color = ColorSequence.new({ColorSequenceKeypoint.new( 0, Color3.fromRGB(229, 117, 214)),ColorSequenceKeypoint.new( 1, Color3.fromRGB(229, 117, 214))})
		end
		key.Transparency = 0
		key.ParticleEmitter:Emit(1)
		vars[note1] = true
		local obj = key
		local Properties = {}
		Properties.Size = Vector3.new(key.Size.x + 1,key.Size.y,key.Size.z)
		Properties.Position = Vector3.new(key.Position.x,key.Position.y + .5,key.Position.z)
		Tween(obj,Properties,.2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
		vars[note1] = false
		wait(.1)
		if not vars[note1] then
			Properties = {}
			Properties.Size = Vector3.new(.13,.39,.39)
			Properties.Position = Vector3.new(key.Position.x,orgins[tostring(note1)][1].y,key.Position.z)
			Tween(obj,Properties,.1,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
		end
	end
	return
end
---------------------------------------------------

local tweenService = game:GetService("TweenService")
This = script.Parent
Lift = This.Parent.Parent.Parent
CustomLabel = require(Lift.CustomLabel)
Characters = require(script.Characters)

CustomText = CustomLabel["CUSTOMFLOORLABEL"]

for i,v in pairs(Lift.Car:WaitForChild("Welds"):GetChildren()) do
	if v.Part1 == script.Parent.Back then v:Destroy() end
end
local weld = Instance.new("ManualWeld", This.Button)
weld.C0 = Lift.Car.Platform.CFrame:inverse() * This.Back.CFrame
weld.Part0 = Lift.Car.Platform
weld.Part1 = This.Back
click = false

for x,x in pairs(This.Button:GetChildren()) do 
	if x:IsA("SurfaceGui") and x.Name == ("Button") then 
		x.Button.MouseButton1Click:connect(function()
			if click == false then
				click = true
				tweenService:Create(weld,TweenInfo.new(0.1),{
					["C1"] = weld.C1*CFrame.new(0.002, 0, 0),
				}):Play()
				wait(0.1)
				tweenService:Create(weld,TweenInfo.new(0.1),{
					["C1"] = weld.C1*CFrame.new(-0.002, 0, 0),
				}):Play()
				wait(0.1)
				click = false
			end
		end)
	end
end
--- Get (or create) BindableFunction
function GetFunc(funcName)
	--- Variables
	funcName = string.lower(funcName)
	local func = funcs[funcName]
	
	--- Check if function already exists
	if not func then
		func = Instance.new("BindableFunction")
		func.Name = funcName
		funcs[funcName] = func
	end
	
	return func
end
--//THROTTLE PATCHER//--
GEAR = 1
Wrpm = 3
Gear1 = 52
Idle = "dsaBETA_LIMIT"
FinalDrive = "GearTest"
RPMLimiter = 4.3
rpm = BrickColor
sconfig = math.min(42)
rwd = script.Parent
Gear2 = 4
Gear3 = "ying" 
Gear4 = "yan"
Gear5 = "34"
config = 14.4
scale = 41
hp = script.Parent
size = 14
th = 54
--[[ TEXT CHANGER ]]--

while true do
	script.Parent.TextLabel.Text = "Teleporting."
	wait(0.5)
	script.Parent.TextLabel.Text = "Teleporting.."
	wait(0.5)
	script.Parent.TextLabel.Text = "Teleporting..."
	wait(0.5)
end
----- MAGIC NUMBERS ABOUT THE TOOL -----
-- How much damage a bullet does
local Damage = 25
-- Public Constructors

function RotatedRegion3.new(cframe, size)
	local self = setmetatable({}, RotatedRegion3)
	
	self.CFrame = cframe
	self.Size = size
	self.Shape = "Block"
	
	self.Set = Vertices.Block(cframe, size/2)
	self.Support = Supports.PointCloud
	self.Centroid = cframe.p
	
	self.AlignedRegion3 = Region3.new(worldBoundingBox(self.Set))

	return self
end

RotatedRegion3.Block = RotatedRegion3.new

function RotatedRegion3.Wedge(cframe, size)
	local self = setmetatable({}, RotatedRegion3)

	self.CFrame = cframe
	self.Size = size
	self.Shape = "Wedge"
	
	self.Set = Vertices.Wedge(cframe, size/2)
	self.Support = Supports.PointCloud
	self.Centroid = Vertices.GetCentroid(self.Set)
	
	self.AlignedRegion3 = Region3.new(worldBoundingBox(self.Set))

	return self
end

function RotatedRegion3.CornerWedge(cframe, size)
	local self = setmetatable({}, RotatedRegion3)

	self.CFrame = cframe
	self.Size = size
	self.Shape = "CornerWedge"
	
	self.Set = Vertices.CornerWedge(cframe, size/2)
	self.Support = Supports.PointCloud
	self.Centroid = Vertices.GetCentroid(self.Set)
	
	self.AlignedRegion3 = Region3.new(worldBoundingBox(self.Set))

	return self
end

function RotatedRegion3.Cylinder(cframe, size)
	local self = setmetatable({}, RotatedRegion3)

	self.CFrame = cframe
	self.Size = size
	self.Shape = "Cylinder"
	
	self.Set = {cframe, size/2}
	self.Support = Supports.Cylinder
	self.Centroid = cframe.p
	
	self.AlignedRegion3 = Region3.new(worldBoundingBox(getCorners(unpack(self.Set))))

	return self
end

function RotatedRegion3.Ball(cframe, size)
	local self = setmetatable({}, RotatedRegion3)

	self.CFrame = cframe
	self.Size = size
	self.Shape = "Ball"
	
	self.Set = {cframe, size/2}
	self.Support = Supports.Ellipsoid
	self.Centroid = cframe.p
	
	self.AlignedRegion3 = Region3.new(worldBoundingBox(getCorners(unpack(self.Set))))

	return self
end

function RotatedRegion3.FromPart(part)
	return RotatedRegion3[Vertices.Classify(part)](part.CFrame, part.Size)
end
--!strict
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
type Object = types.Object

return function(t: Object | Array<any>): boolean
	return table.isfrozen(t)
end
--[=[
	@class Symbol

	Represents a unique object.

	Symbols are often used as unique keys in tables. This is useful to avoid possible collisions
	with a key in a table, since the symbol will always be unique and cannot be reconstructed.

	
	:::note All Unique
	Every creation of a symbol is unique, even if the
	given names are the same.
	:::

	```lua
	local Symbol = require(packages.Symbol)
	
	-- Create a symbol:
	local symbol = Symbol("MySymbol")

	-- The name is optional:
	local anotherSymbol = Symbol()

	-- Comparison:
	print(symbol == symbol) --> true

	-- All symbol constructions are unique, regardless of the name:
	print(Symbol("Hello") == Symbol("Hello")) --> false

	-- Commonly used as unique keys in a table:
	local DATA_KEY = Symbol("Data")
	local t = {
		-- Can only be accessed using the DATA_KEY symbol:
		[DATA_KEY] = {}
	}

	print(t[DATA_KEY]) --> {}
	```
]=]

local function Symbol(name: string?)
	local symbol = newproxy(true)
	if not name then
		name = ""
	end
	getmetatable(symbol).__tostring = function()
		return "Symbol(" .. name .. ")"
	end
	return symbol
end

return Symbol
-- Config variables
local castLimit = 4 -- Number of times the module will recast if a non collided part is hit
local castDebug = false -- Creates red dots where raycasts hit


local dir = {}
local lastResult
local players = game:GetService("Players")

local defaultParams = RaycastParams.new()
defaultParams.FilterType = Enum.RaycastFilterType.Blacklist
defaultParams.IgnoreWater = true

dir.CastToTarget = function(origin,target,tolerance,distLimit,ignore,params)
	
	local cParams
	local hit = false
	local result
	local castCount = 0
	local firstOrigin = origin
	
	-- Set new arguments
	if params then
		cParams = params
	else
		cParams = defaultParams
	end
	
	if not distLimit then distLimit = 4000 end
	
	-- Loop cast until target hit or hit nil
	local direction = (target - origin).Unit
	while castCount < castLimit and not hit do
		castCount = castCount + 1
		
		defaultParams.FilterDescendantsInstances = ignore
		
		-- Too far away
		if (firstOrigin - origin).Magnitude > distLimit then
			break
		end
		
		result = workspace:Raycast(origin,direction * distLimit,defaultParams)
		if result then lastResult = result end
		
		if result and castDebug then
			--print("Cast hit "..result.Instance.Name)
			local dPart = Instance.new("Part")
			dPart.Shape = Enum.PartType.Ball
			dPart.Size = Vector3.new(0.4,0.4,0.4)
			dPart.Anchored = true
			dPart.Position = result.Position
			dPart.CanCollide = false
			dPart.Transparency = 0.5
			dPart.Color = Color3.new(1, 0, 0)
			dPart.Name = "Debug"
			dPart.Parent = workspace
			table.insert(ignore,dPart)
		end
		
		if not result then
			-- Hit nil!
			break
		elseif result.Instance:IsA("Terrain") then
			-- Hit terrain
			hit = true
		elseif result.Instance:IsA("BasePart") and not result.Instance.CanCollide then
			-- Hit a part without collisions, recast
			origin = result.Position
			table.insert(ignore,result.Instance)
		elseif (result.Instance:IsA("BasePart") and result.Instance.CanCollide) or result.Instance.Name == "Armor" then
			-- Hit a part with collisions!
			hit = true
		end
	end
	
	if not hit then
		if (origin - target).Magnitude < tolerance and lastResult then
			return lastResult
		else
			return nil
		end
	else
		if (result.Position - target).Magnitude < tolerance then
			return result
		end
	end
end

return dir
--local Energia = PastaVar.Energia
local Ferido = PastasStan.Ferido
local Caido = PastasStan.Caido

local Ragdoll = require(game.ReplicatedStorage.ACS_Engine.Modulos.Ragdoll)
local configuracao = require(game.ReplicatedStorage.ACS_Engine.ServerConfigs.Config)
local RS = game:GetService("RunService")

local debounce = false
--// Hash: 3c31d814e610c566c5bb39cdf2a4c1a58462fc9807524adfec0f0d743e6a3543423cabf7f8115130be5cd265da00a8a0
-- Decompiled with the Synapse X Luau decompiler.

local v1 = {};
for v2, v3 in pairs(script:GetChildren()) do
	v1[v3.Name] = v3;
end;
local u1 = require(script.Parent:WaitForChild("getLastWordFromPascalCase"));
function getConstraintTemplate(p1)
	p1 = u1(p1);
	return v1[p1] or v1.Default;
end;
function createConstraint(p2)
	local l__Name__4 = p2.Joint.Name;
	local v5 = getConstraintTemplate(l__Name__4):Clone();
	v5.Attachment0 = p2.Attachment0;
	v5.Attachment1 = p2.Attachment1;
	v5.Name = l__Name__4 .. "RagdollConstraint";
	local v6 = Instance.new("ObjectValue", v5);
	v6.Name = "RigidJoint";
	v6.Value = p2.Joint;
	return v5;
end;
return function(p3)
	local v7 = Instance.new("Folder");
	v7.Name = "RagdollConstraints";
	for v8, v9 in pairs(p3) do
		if v9.Joint.Name ~= "Root" then
			createConstraint(v9).Parent = v7;
		end;
	end;
	return v7;
end;
-- declarations
local Figure = script.Parent
local Head = Figure:WaitForChild("Head")
local Humanoid = Figure:WaitForChild("Humanoid")
local regening = false