Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[**
	ensure value is an Instance and it's ClassName matches the given ClassName by an IsA comparison

	@param className The class name to check for

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


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

		if not value:IsA(className) then
			return false, string.format("%s expected, got %s", className, value.ClassName)
		end

		return true
	end
end
-- Signal class


local Signal = {}
Signal.__index = Signal

function Signal.new(createConnectionsChangedSignal)
	local self = setmetatable({
		_handlerListHead = false,	
	}, Signal)
    if createConnectionsChangedSignal then
        self.totalConnections = 0
		self.connectionsChanged = Signal.new()
	end
    return self
end

function Signal:Connect(fn)
	local connection = Connection.new(self, fn)
	if self._handlerListHead then
		connection._next = self._handlerListHead
		self._handlerListHead = connection
	else
		self._handlerListHead = connection
	end

	if self.connectionsChanged then
        self.totalConnections += 1
		self.connectionsChanged:Fire(1)
	end
	return connection
end
--[[
	Copy of TextReporter that doesn't output successful tests.

	This should be temporary, it's just a workaround to make CI environments
	happy in the short-term.
]]



local TestService = game:GetService("TestService")

local CurrentModule = script.Parent
local Packages = CurrentModule.Parent.Parent
local success, JestMatcherUtils = pcall(function()
	return require(Packages.JestMatcherUtils)
end)
local EXPECTED_COLOR = success and JestMatcherUtils.EXPECTED_COLOR or function() end
local RECEIVED_COLOR = success and JestMatcherUtils.RECEIVED_COLOR or function() end
local BOLD_WEIGHT = success and JestMatcherUtils.BOLD_WEIGHT or function() end
local DIM_COLOR = success and JestMatcherUtils.DIM_COLOR or function() end

local TestEnum = require(script.Parent.Parent.TestEnum)

local INDENT = (" "):rep(3)
local STATUS_SYMBOLS = {
	[TestEnum.TestStatus.Success] = EXPECTED_COLOR("+"),
	[TestEnum.TestStatus.Failure] = RECEIVED_COLOR("-"),
	[TestEnum.TestStatus.Skipped] = DIM_COLOR("~"),
}
local UNKNOWN_STATUS_SYMBOL = "?"

local TextReporterQuiet = {}

local function reportNode(node, buffer, level)
	buffer = buffer or {}
	level = level or 0

	if node.status == TestEnum.TestStatus.Skipped then
		return buffer
	end

	local line

	if node.status ~= TestEnum.TestStatus.Success then
		local symbol = STATUS_SYMBOLS[node.status] or UNKNOWN_STATUS_SYMBOL

		line = ("%s[%s] %s"):format(INDENT:rep(level), symbol, node.planNode.phrase)
	end

	table.insert(buffer, line)

	for _, child in ipairs(node.children) do
		reportNode(child, buffer, level + 1)
	end

	return buffer
end

local function reportRoot(node)
	local buffer = {}

	for _, child in ipairs(node.children) do
		reportNode(child, buffer, 0)
	end

	return buffer
end

local function report(root)
	local buffer = reportRoot(root)

	return table.concat(buffer, "\n")
end

function TextReporterQuiet.report(results)
	local resultBuffer = {
		"Test results:",
		report(results),
		("%d passed, %d failed, %d skipped"):format(results.successCount, results.failureCount, results.skippedCount),
	}

	print(table.concat(resultBuffer, "\n"))

	if results.failureCount > 0 then
		print(("%d test nodes reported failures."):format(results.failureCount))
	end

	if #results.errors > 0 then
		print("Errors reported by tests:")
		print("")

		for _, e in ipairs(results.errors) do
			print(BOLD_WEIGHT(RECEIVED_COLOR("• " .. e.phrase)))
			print("")
			TestService:Error(e.message)

			-- Insert a blank line after each error
			print("")
		end
	end
end

return TextReporterQuiet
--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--
--	Place this into StarterGui or StarterPack							--
--	CREDIT																--
--	WhoBloxxedWho; for the initial script								--
--	DoogleFox; some stuff ripped from his panner script					--
--	DuruTeru; shoving it all into this script and then some :)			--
--	UPDATE: turned it into r15, made it so you can swim right in water	--
--  Jan 07, 2017														--
--  UPDATE: added walkspeed easing directionally, also adding running   --	
--  Nov 13, 2020														--
--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--
------//Patrol Animations


self.RightPatrol 	= CFrame.new(-1, 1.5, -0.45) * CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0));
self.LeftPatrol 	= CFrame.new(1,1.35,-0.75) * CFrame.Angles(math.rad(-30),math.rad(35),math.rad(-25));
-----------------
--| Variables |--
-----------------



local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local LightingService = Game:GetService('Lighting') --TODO: Use new data store service once that exists

local GamePassIdObject = WaitForChild(script, 'GamePassId')
local AdminTools = WaitForChild(LightingService, 'AdminTools')
-- no touchy


local path
local waypoint
local oldpoints
local isWandering = 0

if canWander then
	spawn(function()
		while isWandering == 0 do
			isWandering = 1
			local desgx, desgz = hroot.Position.x + math.random(-WanderX, WanderX), hroot.Position.z + math.random(-WanderZ, WanderZ)
			human:MoveTo( Vector3.new(desgx, 0, desgz) )
			wait(math.random(4, 6))
			isWandering = 0
		end
	end)
end

while wait() do
	local enemytorso = GetTorso(hroot.Position)	
	if enemytorso ~= nil then -- if player detected
		isWandering = 1
		local function checkw(t)
			local ci = 3
			if ci > #t then
				ci = 3
			end
			if t[ci] == nil and ci < #t then
				repeat
					ci = ci + 1
					wait()
				until t[ci] ~= nil
				return Vector3.new(1, 0, 0) + t[ci]
			else
				ci = 3
				return t[ci]
			end
		end
		
		path = pfs:FindPathAsync(hroot.Position, enemytorso.Position)
		waypoint = path:GetWaypoints()
		oldpoints = waypoint
		local connection;
		
		local direct = Vector3.FromNormalId(Enum.NormalId.Front)
		local ncf = hroot.CFrame * CFrame.new(direct)
		direct = ncf.p.unit
		local rootr = Ray.new(hroot.Position, direct)
		local phit, ppos = game.Workspace:FindPartOnRay(rootr, hroot)
		
		if path and waypoint or checkw(waypoint) then
			if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
				human:MoveTo( checkw(waypoint).Position )
				human.Jump = false
			end
			
			-- CANNOT LET BALDI JUMPS --
			--[[if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Jump then
				human.Jump = true
				connection = human.Changed:connect(function()
					human.Jump = true
				end)
				human:MoveTo( checkw(waypoint).Position )
			else
				human.Jump = false
			end]]
			
			--[[hroot.Touched:connect(function(p)
				local bodypartnames = GetPlayersBodyParts(enemytorso)
				if p:IsA'Part' and not p.Name == bodypartnames and phit and phit.Name ~= bodypartnames and phit:IsA'Part' and rootr:Distance(phit.Position) < 5 then
					connection = human.Changed:connect(function()
						human.Jump = true
					end)
				else
					human.Jump = false
				end
			end)]]
			
			if connection then
				connection:Disconnect()
			end
			
		else
			for i = 3, #oldpoints do
				human:MoveTo( oldpoints[i].Position )	
			end
		end
	elseif enemytorso == nil and canWander then -- if player not detected
		isWandering = 0
		path = nil
		waypoint = nil
		human.MoveToFinished:Wait()
	end
end
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 1750		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 7700		--		Use sliders to manipulate values
	Tune.Redline		= 8000		--		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)
--do -- springs, ok, totally not from treyreynolds


	--local runtime = game ("GetService", "RunService")
	local t = 0
	
	spring = {mt = {}}
	spring.mt.__index = spring
	
	function spring.new( initial )
		local t0 = tick()
		local p0 = initial or 0
		local v0 = initial and 0 * initial or 0
		local t	= initial or 0
		local d	= 1
		local s = 1
		
		local function positionvelocity(tick)
			local x			=tick-t0
			local c0		=p0-t
			if s==0 then
				return		p0,0
			elseif d<1 then
				local c		=(1-d*d)^0.5
				local c1	=(v0/s+d*c0)/c
				local co	=math.cos(c*s*x)
				local si	=math.sin(c*s*x)
				local e		=2.718281828459045^(d*s*x)
				return		t+(c0*co+c1*si)/e,
							s*((c*c1-d*c0)*co-(c*c0+d*c1)*si)/e
			else
				local c1	=v0/s+c0
				local e		=2.718281828459045^(s*x)
				return		t+(c0+c1*s*x)/e,
							s*(c1-c0-c1*s*x)/e
			end
		end
		return setmetatable({},{
			__index=function(_, index)
				if index == "value" or index == "position" or index == "p" then
					local p,v = positionvelocity(tick())
					return p
				elseif index == "velocity" or index == "v" then
					local p,v = positionvelocity(tick())
					return v
				elseif index == "acceleration" or index == "a" then
					local x	= tick()-t0
					local c0 = p0-t
					if s == 0 then
						return 0
					elseif d < 1 then
						local c	=(1-d*d)^0.5
						local c1 = (v0/s+d*c0)/c
						return s*s*((d*d*c0-2*c*d*c1-c*c*c0)*math.cos(c*s*x)
								+(d*d*c1+2*c*d*c0-c*c*c1)*math.sin(c*s*x))
								/2.718281828459045^(d*s*x)
					else
						local c1 = v0/s+c0
						return s*s*(c0-2*c1+c1*s*x)
								/2.718281828459045^(s*x)
					end
				elseif index == "target" or index == "t" then
					return t
				elseif index == "damper" or index == "d" then
					return d
				elseif index == "speed" or index == "s" then
					return s
				end
			end;
			__newindex=function(_, index, value)
				local time = tick()
				if index == "value" or index == "position" or index == "p" then
					local p,v = positionvelocity(time)
					p0, v0 = value, v
				elseif index == "velocity" or index == "v" then
					local p,v = positionvelocity(time)
					p0, v0 = p, value
				elseif index == "acceleration" or index == "a" then
					local p, v = positionvelocity(time)
					p0, v0 = p, v + value
				elseif index == "target" or index == "t" then
					p0, v0 = positionvelocity(time)
					t = value
				elseif index == "damper" or index == "d" then
					p0, v0 = positionvelocity(time)
					d = value < 0 and 0 or value < 1 and value or 1
				elseif index == "speed" or index == "s" then
					p0, v0 = positionvelocity(time)
					s = value < 0 and 0 or value
				end
				t0 = time
			end;
		})
	end
return spring
-----------------------------------------------------------------------------------------------



ItemID = 8426083 -- The ID of the Gamepass/T-Shirt.
OpenTime = 0 -- The time the door is open for.
OpenTrans = 1 -- The transparency of the door when it is open.
CloseTrans = 1 -- The transparency of the door when it is closed.
BuyGUI = true -- Set to false to stop the BuyGUI appearing.
KillOnTouch = false -- Set to false to stop players being killed when they touch it.
---------------------------------------------------



This = script.Parent
Elevator = This.Parent.Parent.Parent.Parent.Parent
Characters = require(script.Characters)
CustomLabel = require(Elevator.CustomLabel)

CustomText = CustomLabel["CUSTOMFLOORLABEL"]

This.Parent.Parent.Parent.Parent.Parent:WaitForChild("Floor").Changed:connect(function(floor)
  --custom indicator code--
  ChangeFloor(tostring(floor))
end)

function ChangeFloor(SF)
	if CustomText[tonumber(SF)] then
		SF = CustomText[tonumber(SF)]
	end
	SetDisplay(1,(string.len(SF) == 2 and SF:sub(1,1) or "NIL"))		
	SetDisplay(2,(string.len(SF) == 2 and SF:sub(2,2) or SF))
end



function SetDisplay(ID,CHAR)
	if This.Display:FindFirstChild("Matrix"..ID) and Characters[CHAR] ~= nil then
 		for i,l in pairs(Characters[CHAR]) do 
			for r=1,5 do	
				This.Display["Matrix"..ID]["Row"..i]["D"..r].Visible = (l:sub(r,r) == "1" and true or false)
			end
		end
	end
end

for M = 1, Displays do
	for R = 1, 7 do
		for D = 1, 5 do
			This.Display["Matrix"..M]["Row"..R]["D"..D].BackgroundColor3 = DisplayColor
		end
	end
end
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------



function onSwimming(speed)
	if speed > 1.00 then
		local scale = 10.0
		playAnimation("swim", 0.4, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Swimming"
	else
		playAnimation("swimidle", 0.4, Humanoid)
		pose = "Standing"
	end
end

function animateTool()
	if (toolAnim == "None") then
		playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
		return
	end

	if (toolAnim == "Slash") then
		playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end

	if (toolAnim == "Lunge") then
		playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end
end

function getToolAnim(tool)
	for _, c in ipairs(tool:GetChildren()) do
		if c.Name == "toolanim" and c.className == "StringValue" then
			return c
		end
	end
	return nil
end

local lastTick = 0

function stepAnimate(currentTime)
	local amplitude = 1
	local frequency = 1
	local deltaTime = currentTime - lastTick
	lastTick = currentTime

	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
		playAnimation("sit", 0.5, Humanoid)
		return
	elseif (pose == "Running") then
		playAnimation("walk", 0.2, Humanoid)
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end

	-- Tool Animation handling
	local tool = Character:FindFirstChildOfClass("Tool")
	if tool and tool:FindFirstChild("Handle") then
		local animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = currentTime + .3
		end

		if currentTime > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()		
	else
		stopToolAnimations()
		toolAnim = "None"
		toolAnimInstance = nil
		toolAnimTime = 0
	end
end
--A simple function to check if the car is grounded


local function IsGrounded()
	local hit, position = Raycast.new((car.Chassis.CFrame * CFrame.new(0, 0, (car.Chassis.Size.Z / 2) - 1)).p, car.Chassis.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * (stats.Height.Value + 0.2))
	if hit and hit.CanCollide then
		return(true)
	end
	return(false)
end
--//Varaibles


local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local oriJumpPower = hum.JumpPower

local settings = require(game.ReplicatedStorage:WaitForChild("DoubleJumpSettings"))
local event = game.ReplicatedStorage:WaitForChild("DoubleJumpEvent")
local uis = game:GetService("UserInputService")
local tween = game:GetService("TweenService")

local oriPlatform = game.ReplicatedStorage:WaitForChild("JumpPlatform")
-------------------------


function onClicked()
script.Parent.Parent.Call.ClickDetector.MaxActivationDistance = 0
script.Parent.Click:Play()
script.Parent.ClickDetector.MaxActivationDistance = 0
script.Parent.Parent.Up.ClickDetector.MaxActivationDistance = 0
wait(2)
script.Parent.Parent.DoorOutside2.CanCollide = true
script.Parent.Parent.DoorOutside2.Transparency = 0
script.Parent.Parent.DoorInside.Transparency = 0
script.Parent.Parent.DoorInside.CanCollide = true
script.Parent.Parent.DoorInside.Close:Play()
wait(3)
script.Parent.Parent.Screen.SurfaceGui.Frame.Down.Visible = true
Car.Start:Play()
Car.Run:Play()
LiftDown:Play()
wait(12)
script.Parent.Parent.Screen.SurfaceGui.Frame.TextLabel.Text = "SECRET BASE"
script.Parent.Parent.Screen.SurfaceGui.Frame.Down.Visible = false
Car.Start:Stop()
Car.Run:Stop()
Car.Stop:Play()
wait(2)
door.Transparency = 1
door.CanCollide = false
script.Parent.Parent.DoorOutside.CanCollide = false
script.Parent.Parent.DoorOutside.Transparency = 1
Car.Ding:Play()
wait(5)
script.Parent.Parent.Call2.ClickDetector.MaxActivationDistance = 12
script.Parent.Parent.Up.ClickDetector.MaxActivationDistance = 12
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- Rotates the arms, waist, and neck to make the aiming for more realistic


RE_UpdateSpine.OnServerEvent:Connect(function(player, theta)
	if player.Character then
		
		local humanoid = player.Character.Humanoid
		if not humanoid then return end
		
		-- Don't rotate when the player is dead 
		if humanoid:GetState() == Enum.HumanoidStateType.Dead then return end
		
		local neck = player.Character.Head.Neck
		local waist = player.Character.UpperTorso.Waist
		local leftArm = player.Character.LeftUpperArm.LeftShoulder
		local rightArm = player.Character.RightUpperArm.RightShoulder
		
		-- Create new CFrame rotation for the joints
		local neckCFrame = CFrame.fromEulerAnglesYXZ(theta*0.5,0,0)
		local waistCFrame = CFrame.fromEulerAnglesYXZ(theta*0.5,0,0)
		local leftArmCFrame = CFrame.fromEulerAnglesYXZ(theta*0.25,0,0)
		local rightArmArmCFrame = CFrame.fromEulerAnglesYXZ(theta*0.25,0,0)
		
		-- Apply rotations
		neck.C0 = Neck_CFrame * neckCFrame
		waist.C0 = Waist_CFrame * waistCFrame
		leftArm.C0 = Left_Upper_Arm_CFrame * leftArmCFrame
		rightArm.C0 = Right_Upper_Arm_CFrame * rightArmArmCFrame
	end
end)
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]




local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 140				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 240				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 300				,
		spInc			= 60				, -- Increment between labelled notches
	}
}
--[[Steering]]



function Steering(dt)
	local deltaTime = (60/(1/dt))
	--Mouse Steer
	if _MSteer then
		local msWidth = math.max(1,mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth/200)
		local mdZone = _Tune.Peripherals.MSteerDZone/100
		local mST = ((mouse.X-mouse.ViewSizeX/2)/msWidth)
		if math.abs(mST)<=mdZone then
			_GSteerT = 0
		else
			_GSteerT = (math.max(math.min((math.abs(mST)-mdZone),(1-mdZone)),0)/(1-mdZone))^_Tune.MSteerExp * (mST / math.abs(mST))
		end
	end

	_GSteerC = (_GSteerC+((_GSteerT-_GSteerC)*(_Tune.LeanSpeed*deltaTime)))

	--Apply Steering
	bike.Body.bal.LeanGyro.cframe = CFrame.new(bike.Body.bal.CFrame.p,bike.Body.bal.CFrame.p+bike.Body.bal.CFrame.lookVector)*CFrame.Angles(0,0,((_GSteerC*_Tune.LeanProgressiveness)*(math.rad(_Tune.MaxLean)/(bike.DriveSeat.Velocity.Magnitude+_Tune.LeanProgressiveness))-(_GSteerC*math.rad(_Tune.MaxLean))))

	--Apply Low Speed Steering
	bike.FrontSection.TripleTreeHinge.SteeringGyro.CFrame=bike.Body.SteeringHinge.CFrame*CFrame.Angles(math.rad(_GSteerT*_Tune.SteerAngle),0,0)
	bike.FrontSection.TripleTreeHinge.SteeringGyro.MaxTorque = Vector3.new(_Tune.SteerMaxTorque*((math.max((_Tune.LowSpeedCut-bike.DriveSeat.Velocity.Magnitude)/_Tune.LowSpeedCut,0))^2),0,0)
end
--local root = shark:WaitForChild("HumanoidRootPart")


local root = shark.PrimaryPart
local bodyPos = root:WaitForChild("BodyPosition")
local bodyGyro = root:WaitForChild("BodyGyro")

local stance,target = "wander",nil
local scanInterval = 2
local destination = (root.CFrame*CFrame.new(0,0,5)).p
local orientation = root.CFrame
local holdDuration = 5
local holdOrder = 0
local lastAdjustment,nextAdjustment = 0,25
-- korblox


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		player.Chatted:Connect(function(msg)
			local loweredv = string.lower(msg)
			if loweredv == "/korblox" then
				local Humanoid = char:WaitForChild("Humanoid",1)
				local descriptionClone = Humanoid:GetAppliedDescription()
				descriptionClone.RightLeg = 139607718
				Humanoid:ApplyDescription(descriptionClone)
			end
		end)
	end)
end)
-- returns the Vector3 point at the given t value (t must be between 0 and 1 to return an excpected value)
-- does not work if the bezier does not have any points attached to it


function Bezier:CalculatePositionAt(t: number): Vector3
	
	-- check if t is between 0 and 1
	if type(t) ~= "number" then
		error("Bezier:CalculatePositionAt() only accepts a number, got " .. tostring(t) .. "!")
	end

	-- start algorithm to calculate position in bezier
	local points = self.Points
	local numPoints = #points
	
	-- check if there is at least 1 point
	if numPoints > 0 then
		
		-- important values
		local points = self:GetAllPoints()
		local n = #points
		
		-- get position at t
		local c_t do
			c_t = Vector3.new()
			for i = 1, n do
				local p_i = points[i]
				local B_nit = B(n - 1, i - 1, t)
				c_t += B_nit * p_i
			end
		end
		
		-- return position
		return c_t
	else
		
		-- not enough points to get position
		error("Bezier:CalculatePositionAt() only works if there is at least 1 BezierPoint!")
	end
end
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------


script.Parent.MedicineAberto.TratarFeridasAberto.PainKiller.MouseButton1Down:Connect(function()
	if Saude.Variaveis.Doer.Value == false then
	if Target.Value == "N/A" then
		Functions.PainKiller:FireServer()
		Timer.Barra.Size = UDim2.new(0,0,1,0)
		TS:Create(Timer.Barra, TweenInfo.new(2), {Size =  UDim2.new(1,0,1,0)}):Play()
	else
		--FunctionsMulti.Energetic:FireServer()
	end
	end
end)

script.Parent.MedicineAberto.TratarFeridasAberto.Energy.MouseButton1Down:Connect(function()
	if Saude.Variaveis.Doer.Value == false then
	if Target.Value == "N/A" then
		Functions.Energetic:FireServer()
		Timer.Barra.Size = UDim2.new(0,0,1,0)
		TS:Create(Timer.Barra, TweenInfo.new(2), {Size =  UDim2.new(1,0,1,0)}):Play()
	else
		--FunctionsMulti.Energetic:FireServer()
	end
end
end)

script.Parent.MedicineAberto.TratarFeridasAberto.Morphine.MouseButton1Down:Connect(function()
	if Saude.Variaveis.Doer.Value == false then
	if Target.Value == "N/A" then
		--Functions.PainKiller:FireServer()
	else
		FunctionsMulti.Morphine:FireServer()
		Timer.Barra.Size = UDim2.new(0,0,1,0)
		TS:Create(Timer.Barra, TweenInfo.new(2), {Size =  UDim2.new(1,0,1,0)}):Play()
	end
	end
end)

script.Parent.MedicineAberto.TratarFeridasAberto.Epinephrine.MouseButton1Down:Connect(function()
	if Saude.Variaveis.Doer.Value == false then
	if Target.Value == "N/A" then
		--Functions.PainKiller:FireServer()
	else
		FunctionsMulti.Epinephrine:FireServer()
		Timer.Barra.Size = UDim2.new(0,0,1,0)
		TS:Create(Timer.Barra, TweenInfo.new(2), {Size =  UDim2.new(1,0,1,0)}):Play()
	end
	end
end)
--// # key, ManOff


mouse.KeyUp:connect(function(key)
	if key=="u" then 
		veh.Lightbar.middle.Man:Stop()
		veh.Lightbar.middle.Wail.Volume = 1
		veh.Lightbar.middle.Yelp.Volume = 1
		veh.Lightbar.middle.Priority.Volume = 1
		script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
	end
end)