Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- declarations



local Figure = script.Parent.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")

local sGettingUp = waitForChild(Head, "GettingUp")
local sDied = waitForChild(Head, "Died") 
local sFreeFalling = waitForChild(Head, "FreeFalling")
local sJumping = waitForChild(Head, "Jumping")
local sLanding = waitForChild(Head, "Landing")
local sSplash = waitForChild(Head, "Splash")
local sRunning = waitForChild(Head, "Running")
sRunning.Looped = true
local sSwimming = waitForChild(Head, "Swimming")
sSwimming.Looped = true
local sClimbing =waitForChild(Head, "Climbing")
sClimbing.Looped = true

local prevState = "None"
--!strict


local function PageIterator(pages)
	return coroutine.wrap(function()
		local pageNumber = 1
		
		while true do
			for _, item in pages:GetCurrentPage() do
				coroutine.yield(item, pageNumber)
			end
			
			if pages.IsFinished then
				break
			end
			
			pages:AdvanceToNextPageAsync()
			pageNumber += 1
		end
	end)
end

return PageIterator
--[[
	Sets the position of the internal springs, meaning the value of this
	Spring will jump to the given value. This doesn't affect velocity.

	If the type doesn't match the current type of the spring, an error will be
	thrown.
]]


function class:setPosition(newValue: PubTypes.Animatable)
	local newType = typeof(newValue)
	if newType ~= self._currentType then
		logError("springTypeMismatch", nil, newType, self._currentType)
	end

	self._springPositions = unpackType(newValue, newType)
	self._currentValue = newValue
	SpringScheduler.add(self)
	updateAll(self)
end
--[[Weight and CG]]


	Tune.Weight			= 8000		-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		8		,
	 --[[Height]]		15		,
	 --[[Length]]		25		}
	Tune.WeightDist		= 30		-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
	Tune.CGHeight		= 2	-- Center of gravity height (studs relative to median of all wheels)
	Tune.WBVisible		= false		-- Makes the weight brick visible
	
	--Unsprung Weight
	Tune.FWheelDensity	= .5		-- Front Wheel Density
	Tune.RWheelDensity	= .5		-- 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
-- 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
-- Spritesheet


local Sprite = {
	Width = 13;
	Height = 13;
}

local Spritesheet = {
	Image = "http://www.roblox.com/asset/?id=128896947";
	Height = 256;
	Width = 256;
}

local Images = {
	"unchecked",
	"checked",
	"unchecked_over",
	"checked_over",
	"unchecked_disabled",
	"checked_disabled"
}

local function SpritePosition(spriteName)
	local x = 0
	local y = 0
	for i,v in pairs(Images) do
		if (v == spriteName) then
			return {x, y}
		end
		x = x + Sprite.Height
		if (x + Sprite.Width) > Spritesheet.Width then
			x = 0
			y = y + Sprite.Height
		end
	end
end

local function GetCheckboxImageName(checked, readOnly, mouseover)
	if checked then
		if readOnly then
			return "checked_disabled"
		elseif mouseover then
			return "checked_over"
		else
			return "checked"
		end
	else
		if readOnly then
			return "unchecked_disabled"
		elseif mouseover then
			return "unchecked_over"
		else
			return "unchecked"
		end
	end
end

local MAP_ID = 418720155
--[[
	Constructs and returns objects which can be used to model independent
	reactive state.
]]



local Package = script.Parent.Parent
local Types = require(Package.Types)
local useDependency = require(Package.Dependencies.useDependency)
local initDependency = require(Package.Dependencies.initDependency)
local updateAll = require(Package.Dependencies.updateAll)
local isSimilar = require(Package.Utility.isSimilar)

local class = {}

local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
-- Dark was here.


local nearplayer 
local Players = game:GetService("Players")
while true do
	nearplayer = false

	for _,Player in next, Players:GetPlayers() do 
		if Player.Character and Player.Character.PrimaryPart then
			local dis = (Player.Character.PrimaryPart.CFrame.Position - banto.PrimaryPart.CFrame.Position).Magnitude
			if dis >= 500 then
				nearplayer = true
				break
			end
		end
	end

	if nearplayer then
		task.wait(math.random(8, 8 + 8/2))
		continue
	end
	
	
	bp.Parent = banto.PrimaryPart
	local goal
	repeat 
		local ray = Ray.new(
			Vector3.new(origin.p.x+math.random(-tether,tether),100,origin.p.z+math.random(-tether,tether)),
			Vector3.new(0,-1000,0)
		)
		local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
		if part == workspace.Terrain and mat ~= Enum.Material.Water then
			goal = pos+Vector3.new(0,2.25,0)
		end
		wait()
	until goal
	-- move the banto to the newfound goal
	walk:Play()
	bg.CFrame = CFrame.new(banto.PrimaryPart.Position,goal)
	bp.Position = (CFrame.new(banto.PrimaryPart.Position,goal)*CFrame.new(0,0,-100)).Position

	local start = tick()
	repeat wait(1/2) 
		local ray = Ray.new(banto.PrimaryPart.Position,Vector3.new(0,-1000,0))
		--local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
		--banto:MoveTo(Vector3.new(banto.PrimaryPart.Position.X,pos.Y+2.25,banto.PrimaryPart.Position.Z))
		--bp.Position = Vector3.new(bp.Position.X,pos.Y+2.25,bp.Position.Z)

	until (banto.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >10
	walk:Stop()
	bp.Parent = nil
	wait(math.random(3,8))
end
-- RECOMMENDED TO DISABLE A SHIFT TO SPRINT SCRIPT. ENABLE IT ON LINE 34.



script.Parent.MouseButton1Click:Connect(function()

	buttons.Settings.Content.Button.PopupScript.Disabled = true
	buttons.UpdateLog.Content.Button.PopupScript.Disabled = true
	buttons.Credits.Content.Button.PopupScript.Disabled = true
	buttons.Shop.Content.Button.PopupScript.Disabled = true
	buttons.Play.Content.Button.PlayScript.Disabled = true

	buttons.Settings:TweenPosition(UDim2.new(-0.25, 0,0.51, 0), "InOut", "Quad", 0.5, true)
	buttons.Shop:TweenPosition(UDim2.new(1.25, 0,0.51, 0), "InOut", "Quad", 0.5, true)
	buttons.Credits:TweenPosition(UDim2.new(1.25, 0,0.864, 0), "InOut", "Quad", 0.5, true)
	buttons.UpdateLog:TweenPosition(UDim2.new(-0.25, 0,0.864, 0), "InOut", "Quad", 0.5, true)
	buttons.Play:TweenPosition(UDim2.new(0.5, 0,-0.5, 0), "InOut", "Quad", 0.5, true)
	title:TweenPosition(UDim2.new(0.5, 0,1.5, 0), "InOut", "Quad", 0.5, true)

	wait(0.5)
	
	buttons.Parent.Blackout:TweenPosition(UDim2.new(0.5, 0,0.5, 0), "InOut", "Quad", 0.5, true)
	
	wait(0.5)
	
	plr.Character.HumanoidRootPart.CFrame = spawnpart.CFrame * CFrame.new(0, 3, 0)
	plr.Character.Humanoid.WalkSpeed = 16 -- IF THIS IS CUSTOM IN YOUR GAME, EDIT THIS. (DEFAULT = 16)
	plr.Character.Humanoid.JumpHeight = 7.2 -- IF THIS IS CUSTOM IN YOUR GAME, EDIT THIS. (DEFAULT = 7.2)
	
	
	
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, true)
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
	
	script.Parent.Parent.Parent.Parent.Parent.Parent.Music:Stop()
	buttons.Parent.Parent.Camera.Disabled = true
	workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
	buttons.Parent.Parent.BackToMenu.Content.Button.B2MScript.Disabled = false
	buttons.Parent.Parent.BackToMenu.Visible = true
	buttons.Parent.Blackout:TweenPosition(UDim2.new(-0.5, 0,0.5, 0), "InOut", "Quad", 0.5, true)
	
end)
-- Teknikk Sounder Core V1 --


local Status = script.Parent.Parent.Status
local Tone = script.Parent.Parent.SounderTone
local SounderSync = script.Parent.Parent.SounderSync
local Run = false
Status.Changed:connect(function()
	if Run then return end
	Run = true
	if Status.Value == 1 --ALARM
	or Status.Value == 12 --TEST
	then
	wait(1)
	if Tone.Value == 1 then -- CONTINIUS 
		SounderSync.Value = true
		Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
	end
	
	if Tone.Value == 2 then -- PULSE 	
		while true do
			wait(0.2)
			SounderSync.Value = true
			Status.Parent.Panel.Relay.Pitch = 3
			Status.Parent.Panel.Relay:Play()
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
			wait(0.2)			
			Status.Parent.Panel.Relay.Pitch = 2.5
			Status.Parent.Panel.Relay:Play()
			SounderSync.Value = false
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Sand red")
		end
	end

	if Tone.Value == 3 then -- CODE 3
		while true do
			for C3 = 1, 3 do
			wait(0.3)
			SounderSync.Value = true
			Status.Parent.Panel.Relay.Pitch = 3
			Status.Parent.Panel.Relay:Play()
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
			wait(0.6)
			SounderSync.Value = false
			Status.Parent.Panel.Relay.Pitch = 2.5
			Status.Parent.Panel.Relay:Play()
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Sand red")
			end
			wait(1.5)
		end
	end
	
	end
end)
SounderSync.Value = false
Status.Parent.Panel.Relay.Pitch = 2.5
Status.Parent.Panel.Relay:Play()
--[=[
	Begins a Promise chain, calling a function and returning a Promise resolving with its return value. If the function errors, the returned Promise will be rejected with the error. You can safely yield within the Promise.try callback.

	:::info
	`Promise.try` is similar to [Promise.promisify](#promisify), except the callback is invoked immediately instead of returning a new function.
	:::

	```lua
	Promise.try(function()
		return math.random(1, 2) == 1 and "ok" or error("Oh an error!")
	end)
		:andThen(function(text)
			print(text)
		end)
		:catch(function(err)
			warn("Something went wrong")
		end)
	```

	@param callback (...: any) -> ...any
	@return Promise
]=]


function Promise.try(...)
	return Promise._try(debug.traceback(nil, 2), ...)
end
-- Local Variables


local ScoreFrame = script.Parent.ScreenGui.ScoreFrame
local VictoryFrame = script.Parent.ScreenGui.VictoryMessage
local Events = game.ReplicatedStorage.Events
local DisplayNotification = Events.DisplayNotification
local DisplayVictory = Events.DisplayVictory
local DisplayScore = Events.DisplayScore
local ResetMouseIcon = Events.ResetMouseIcon
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local MouseIcon = Mouse.Icon
-- Actual measured distance to the camera Focus point, which may be needed in special circumstances, but should
-- never be used as the starting point for updating the nominal camera-to-subject distance (self.currentSubjectDistance)
-- since that is a desired target value set only by mouse wheel (or equivalent) input, PopperCam, and clamped to min max camera distance


function BaseCamera:GetMeasuredDistanceToFocus()
	local camera = game.Workspace.CurrentCamera
	if camera then
		return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
	end
	return nil
end

function BaseCamera:GetCameraLookVector()
	return game.Workspace.CurrentCamera and game.Workspace.CurrentCamera.CFrame.lookVector or UNIT_Z
end
--------------------------------------------------------------------------------



while true do
	while Humanoid.Health < Humanoid.MaxHealth and Humanoid.Health > 0 and Humanoid:GetState() ~= Enum.HumanoidStateType.Dead do
		local dt = wait(REGEN_STEP)
		local dh = dt * REGEN_RATE * Humanoid.MaxHealth
		Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
	end
	Humanoid.HealthChanged:Wait()
end
-- setup emote chat hook
--game:GetService("Players").LocalPlayer.Chatted:connect(function(msg)
--	local emote = ""
--	if (string.sub(msg, 1, 3) == "/e ") then
--		emote = string.sub(msg, 4)
--	elseif (string.sub(msg, 1, 7) == "/emote ") then
--		emote = string.sub(msg, 8)
--	end
--	
--	if (pose == "Standing" and emoteNames[emote] ~= nil) then
--		playAnimation(emote, 0.1, Humanoid)
--	end
--end)
--Code--


local function PlayerTouched(Part)
	local Parent = Part.Parent
	if game.Players:GetPlayerFromCharacter(Parent) then
		wait(0.8)
		Brick.Transparency=Brick.Transparency+0.8
		Brick.CanCollide=false
		wait(2)
		Brick.Transparency=0
		Brick.CanCollide=true
	end
end

Brick.Touched:connect(PlayerTouched)
--[[
    Instantiates object fields
]]


function VehicleLightsComponent:setup()
	local lights = self.model:FindFirstChild("Lights")
	local headLights = lights:FindFirstChild("HeadLights")
	local brakeLights = lights:FindFirstChild("BrakeLights")

	self.headLights = headLights:GetChildren()
	self.brakeLights = brakeLights:GetChildren()
end
--------------------------------------------------------------------------------------------
-- Popper uses the level geometry find an upper bound on subject-to-camera distance.
--
-- Hard limits are applied immediately and unconditionally. They are generally caused
-- when level geometry intersects with the near plane (with exceptions, see below).
--
-- Soft limits are only applied under certain conditions.
-- They are caused when level geometry occludes the subject without actually intersecting
-- with the near plane at the target distance.
--
-- Soft limits can be promoted to hard limits and hard limits can be demoted to soft limits.
-- We usually don"t want the latter to happen.
--
-- A soft limit will be promoted to a hard limit if an obstruction
-- lies between the current and target camera positions.
--------------------------------------------------------------------------------------------



local subjectRoot
local subjectPart

camera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
	local subject = camera.CameraSubject
	if subject:IsA("Humanoid") then
		subjectPart = subject.RootPart
	elseif subject:IsA("BasePart") then
		subjectPart = subject
	else
		subjectPart = nil
	end
end)

local function canOcclude(part)
	-- Occluders must be:
	-- 1. Opaque
	-- 2. Interactable
	-- 3. Not in the same assembly as the subject

	return
		getTotalTransparency(part) < 0.25 and
		part.CanCollide and
		subjectRoot ~= (part:GetRootPart() or part) and
		not part:IsA("TrussPart")
end
--- Cleans up all tasks.
-- @alias Destroy


function Maid:DoCleaning()
	local tasks = self._tasks

	-- Disconnect all events first as we know this is safe
	for index, task in pairs(tasks) do
		if typeof(task) == "RBXScriptConnection" then
			tasks[index] = nil
			task:Disconnect()
		end
	end

	-- Clear out tasks table completely, even if clean up tasks add more tasks to the maid
	local index, task = next(tasks)
	while task ~= nil do
		tasks[index] = nil
		if type(task) == "function" then
			task()
		elseif typeof(task) == "RBXScriptConnection" then
			task:Disconnect()
		elseif task.Destroy then
			task:Destroy()
		end
		index, task = next(tasks)
	end
end
--[[--------------------------------------------------------------------
-- Notes:
-- * EOZ is implemented as a string, "EOZ"
-- * Format of z structure (ZIO)
--     z.n       -- bytes still unread
--     z.p       -- last read position position in buffer
--     z.reader  -- chunk reader function
--     z.data    -- additional data
-- * Current position, p, is now last read index instead of a pointer
--
-- Not implemented:
-- * luaZ_lookahead: used only in lapi.c:lua_load to detect binary chunk
-- * luaZ_read: used only in lundump.c:ezread to read +1 bytes
-- * luaZ_openspace: dropped; let Lua handle buffers as strings (used in
--   lundump.c:LoadString & lvm.c:luaV_concat)
-- * luaZ buffer macros: dropped; buffers are handled as strings
-- * lauxlib.c:getF reader implementation has an extraline flag to
--   skip over a shbang (#!) line, this is not implemented here
--
-- Added:
-- (both of the following are vaguely adapted from lauxlib.c)
-- * luaZ:make_getS: create Reader from a string
-- * luaZ:make_getF: create Reader that reads from a file
--
-- Changed in 5.1.x:
-- * Chunkreader renamed to Reader (ditto with Chunkwriter)
-- * Zio struct: no more name string, added Lua state for reader
--   (however, Yueliang readers do not require a Lua state)
----------------------------------------------------------------------]]



local luaZ = {}
--[[Brakes]]


	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 15000000		-- Front brake force
	Tune.RBrakeForce	= 10000000		-- Rear brake force
	Tune.PBrakeForce	= 50000000	-- Handbrake force
	
	Tune.FLgcyBForce	= 1500000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 1000000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 2500000		-- Handbrake force [PGS OFF]
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS




function onPlayerRespawned(newPlayer)
	while true do
		if newPlayer.Character ~= nil then break end
		wait(.1)
	end
	local newJob = script.Health:Clone()
	newJob.Disabled = false
	newJob.Parent = newPlayer.Character
end

function onPlayerEntered(newPlayer)
	newPlayer.Changed:connect(function (property)
		if (property == "Character") then
			onPlayerRespawned(newPlayer)
		end
	end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)
----------------------------------------------------------------------


end


function computeLaunchAngle(dx,dy,grav)
	-- arcane
	-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
	
	local g = math.abs(grav)
	local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
	if inRoot <= 0 then
		return .25 * math.pi
	end
	local root = math.sqrt(inRoot)
	local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)

	local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
	local answer1 = math.atan(inATan1)
	local answer2 = math.atan(inATan2)
	if answer1 < answer2 then return answer1 end
	return answer2
end

function computeDirection(vec)
	local lenSquared = vec.magnitude * vec.magnitude
	local invSqrt = 1 / math.sqrt(lenSquared)
	return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end




Tool.Enabled = true
function onActivated()

	if not Tool.Enabled then
		local bewl = script.Parent:FindFirstChild("Bool")
		if bewl then
			bewl:Destroy()
		end
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	local targetPos = humanoid.TargetPoint
	script.Parent.Handle.SlingshotSound:Play()
	fire(targetPos)


	Tool.Enabled = true
end

script.Parent.Activated:connect(onActivated)
-- ANimation


local Sound = script:WaitForChild("Haoshoku Sound")

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.X and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = 2
		Track1 = plr.Character.Humanoid:LoadAnimation(script.AnimationCharge)
		Track1:Play()
		script.RemoteEventS:FireServer()
		for i = 1,math.huge do
			if Debounce == 2 then
				
				plr.Character.HumanoidRootPart.Anchored = true
			else
				
				break
				end
	     wait()
	  end
	end
end)

UIS.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.X and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = 3
		local Track2 = plr.Character.Humanoid:LoadAnimation(script.AnimationRelease)
		Track2:Play()
		Track1:Stop()
		Sound:Play()
		local camera = game.Workspace.CurrentCamera
		local CameraShaker = require(game.ReplicatedStorage.CameraShaker)
		local camshake = CameraShaker.new(Enum.RenderPriority.Camera.Value,function(shakeCFrame)
			camera.CFrame = camera.CFrame * shakeCFrame
		end)
		camshake:Start()
		camshake:Shake(CameraShaker.Presets.Explosion)
		local mousepos = Mouse.Hit
		script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
		wait(1)
		plr.Character.LeftHand.EFhand:Destroy()
		plr.Character.RightHand.EFhand:Destroy()
		Track2:Stop()
		wait(.5)
		Tool.Active.Value = "None"
		wait(1.5)
		plr.Character.HumanoidRootPart.Anchored = false
		wait(5)
		Debounce = 1
	end
end)
--[[
    There is a bug where the Humanoid will enter RunningNoPhysics and pass though the barriers,
    here we disable that state.

    Also, set the character's Z velocity to match that of the platform when the character is in Freefall
]]


local function setupPlatformMinigame()
	local localPlayer = Players.localPlayer
	local character = localPlayer.Character

	if character then
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			humanoid:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, false)
			if humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics then
				humanoid:ChangeState(Enum.HumanoidStateType.Running)
			end

			local platformPart

			connection =
				RunService.Stepped:Connect(
				function()
					-- The platform part may not have replicated yet, so we need to make sure it exists
					if not platformPart then
						local map = workspace:FindFirstChild("Platform")
						if map then
							local platformModel = map:FindFirstChild("Platform")
							if platformModel then
								platformPart = platformModel.PrimaryPart
							end
						end
					end

					if not platformPart then
						return
					end

					-- When the Humanoid is in Freefall it will no longer be governed by the platform's velocity
					if humanoid.RootPart and humanoid:GetState() == Enum.HumanoidStateType.Freefall then
						local rootPos = humanoid.RootPart.Position
						-- Check if the character is in bounds of the platform
						if not isVector3InBoundsOfPart(rootPos, platformPart) then
							return
						end

						local rootVelocity = humanoid.RootPart.Velocity
						humanoid.RootPart.Velocity = Vector3.new(rootVelocity.X, rootVelocity.Y, platformPart.Velocity.Z)
					end
				end
			)
		end
	end
end

return function(minigameName)
	if connection then
		connection:Disconnect()
		connection = nil
	end
	if minigameName == "Platform Panic" then
		setupPlatformMinigame()
	end
end