Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets


local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t: number)
	t = math.clamp(t, -1, 1)
	if t >= 0 then
		return (k*t) / (k - t + 1)
	end
	return -((lowerK*-t) / (lowerK + t + 1))
end

local DEADZONE = 0.1
local function toSCurveSpace(t: number)
	return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end

local function fromSCurveSpace(t: number)
	return t/2 + 0.5
end

function CameraUtils.GamepadLinearToCurve(thumbstickPosition: Vector2)
	local function onAxis(axisValue)
		local sign = 1
		if axisValue < 0 then
			sign = -1
		end
		local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
		point = point * sign
		return math.clamp(point, -1, 1)
	end
	return Vector2.new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
------------------------------------------------------------------------
-- make header (from lundump.c)
-- returns the header string
------------------------------------------------------------------------


function luaU:header()
 local x = 1
 return self.LUA_SIGNATURE..
        string.char(
          self.LUAC_VERSION,
          self.LUAC_FORMAT,
          x,                    -- endianness (1=little)
          4,                    -- sizeof(int)
          4,                    -- sizeof(size_t)
          4,                    -- sizeof(Instruction)
          8,                    -- sizeof(lua_Number)
          0)                    -- is lua_Number integral?
end
--[[Weight and CG]]


	Tune.Weight			= 6000 		-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		5		,
	 --[[Height]]		8		,
	 --[[Length]]		17		}
	Tune.WeightDist		= 60		-- 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
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------



function onRunning(speed)
	if speed>0 then
		playAnimation("walk", 0.1, Humanoid)
		pose = "Running"
	else
		playAnimation("idle", 0.1, Humanoid)
		pose = "Standing"
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	playAnimation("jump", 0.1, Humanoid)
	jumpAnimTime = jumpAnimDuration
	pose = "Jumping"
end

function onClimbing(speed)
	playAnimation("climb", 0.1, Humanoid)
	setAnimationSpeed(speed / 12.0)
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	if (jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	end
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function onSwimming(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function getTool()	
	for _, kid in ipairs(Figure:GetChildren()) do
		if kid:IsA("Tool") then return kid end
	end
	return nil
end

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

function animateTool()
	if (toolAnim == "None") then
		playToolAnimation("toolnone", toolTransitionTime, Humanoid)
		return
	end
	if (toolAnim == "Slash") then
		playToolAnimation("toolslash", 0, Humanoid)
		return
	end
	if (toolAnim == "Lunge") then
		playToolAnimation("toollunge", 0, Humanoid)
		return
	end
end

function moveSit()
	RightShoulder.MaxVelocity = 0.15
	LeftShoulder.MaxVelocity = 0.15
	RightShoulder:SetDesiredAngle(3.14 /2)
	LeftShoulder:SetDesiredAngle(-3.14 /2)
	RightHip:SetDesiredAngle(3.14 /2)
	LeftHip:SetDesiredAngle(-3.14 /2)
end

local lastTick = 0

function move(time)
	local amplitude = 1
	local frequency = 1
  	local deltaTime = time - lastTick
  	lastTick = time
	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
		stopAllAnimations()
		moveSit()
		return
	elseif (pose == "Running") then
		playAnimation("walk", 0.1, Humanoid)
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
--Expanding Blood Parts Function


local expandBlood = function(part)
	
	local randomIncrement = math.random(5, 10) / 10
	
	local tween = tweenSize(part, 5, Enum.EasingDirection.Out,
		Vector3.new(part.Size.X + randomIncrement, 0.1, part.Size.Z + randomIncrement)
	)
	
	spawn(function()
		tween.Completed:Wait()
		tween:Destroy()
	end)
end
-- This script provides one aspect of support for older maps that use EventScript
-- by providing a module in a location where those older maps expect it.
-- 
-- ForbiddenJ



local WaterLib = require(game.ReplicatedStorage.WaterLib)

local mod = {}

function mod.moveWater(water, move, dur, isLocalSpace)
	return WaterLib.MoveWater(water, move, dur, isLocalSpace)
end
function mod.setWaterState(water, state)
	return WaterLib.SetWaterState(water, state)
end

return mod
-- Local Functions


local function onCharacterAdded(character)
	wait(1) -- You want to wait for the Animate script to load and run
	
	local humanoid = character:WaitForChild("Humanoid")
	for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingTracks:Stop(0)
	end
 
	local animateScript = character:WaitForChild("Animate")
	
	for _, anim in ipairs(replacementAnimations) do
		if not anim.isLoaded then continue end

		local animations = animateScript:WaitForChild(anim.name):GetChildren()
		-- Overwrite the IDs of all idle animation instances
		for _, animVariant in ipairs(animations) do
			animVariant.AnimationId = anim.id

			-- If you really want to prevent the animations from being changed by something else you could do this too
			animVariant:GetPropertyChangedSignal("AnimationId"):Connect(function()
				animVariant.AnimationId = anim.id
			end)
		end
	end
	
	-- Stop all currently playing animation tracks on the player
	for _, playingAnimation in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingAnimation:Stop()
		playingAnimation:Destroy()
	end
end
 
local function onPlayerAdded(player)
	--Only run this code if an animation actually is loaded in. 
	local character = player.Character or player.CharacterAdded:wait()
	onCharacterAdded(character)
end
--		print("Keyframe : ".. frameName)



		local repeatAnim = currentAnim
		-- return to idle if finishing an emote
		if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
			repeatAnim = "idle"
		end
		
		local animSpeed = currentAnimSpeed
		playAnimation(repeatAnim, 0.15, Enemy)
		setAnimationSpeed(animSpeed)
	end
end
-- Teleport.lua, inside your commands folder as defined above.


return {
	Name = "teleport";
	Aliases = {"tp"};
	Description = "Teleports a player or set of players to one target.";
	Group = "Admin";
	Args = {
		{
			Type = "players";
			Name = "from";
			Description = "The players to teleport";
		},
		{
			Type = "player";
			Name = "to";
			Description = "The player to teleport to"
		}
	};
}
-- << LOCAL FUNCTIONS >>


local function setupOriginalZIndex(frame, forceOnTop)
	for a,b in pairs(frame:GetDescendants()) do
		if b:IsA("GuiObject") and b:FindFirstChild("OriginalZIndex") == nil then
			local iValue = Instance.new("IntValue")
			iValue.Name = "OriginalZIndex"
			local zValue = b.ZIndex
			if forceOnTop then
				zValue = zValue + 10000
			end
			iValue.Value = zValue
			iValue.Parent = b
		end
	end
end
local function updateZIndex(list, specificFrame)
	for i,v in pairs(main.commandMenus) do
		for a,b in pairs(v:GetDescendants()) do
			if b:IsA("GuiObject") then
				if b:FindFirstChild("OriginalZIndex") and (not specificFrame or v == specificFrame) then
					b.ZIndex = b.OriginalZIndex.Value + ((i-1)*10) - 1000
				end
			end
		end
	end
end
--[[

	VectorUtil.ClampMagnitude(vector, maxMagnitude)
	VectorUtil.AngleBetween(vector1, vector2)
	VectorUtil.AngleBetweenSigned(vector1, vector2, axisVector)


	EXAMPLES:

		ClampMagnitude:

			Clamps the magnitude of a vector so it is only a certain length.

			ClampMagnitude(Vector3.new(100, 0, 0), 15) == Vector3.new(15, 0, 0)
			ClampMagnitude(Vector3.new(10, 0, 0), 20)  == Vector3.new(10, 0, 0)

		
		AngleBetween:

			Finds the angle (in radians) between two vectors.

			v1 = Vector3.new(10, 0, 0)
			v2 = Vector3.new(0, 10, 0)
			AngleBetween(v1, v2) == math.rad(90)

		
		AngleBetweenSigned:

			Same as AngleBetween, but returns a signed value.

			v1 = Vector3.new(10, 0, 0)
			v2 = Vector3.new(0, 0, -10)
			axis = Vector3.new(0, 1, 0)
			AngleBetweenSigned(v1, v2, axis) == math.rad(90)

--]]




local VectorUtil = {}


function VectorUtil.ClampMagnitude(vector, maxMagnitude)
	return (vector.Magnitude > maxMagnitude and (vector.Unit * maxMagnitude) or vector)
end


function VectorUtil.AngleBetween(vector1, vector2)
	return math.acos(math.clamp(vector1.Unit:Dot(vector2.Unit), -1, 1))
end


function VectorUtil.AngleBetweenSigned(vector1, vector2, axisVector)
	local angle = VectorUtil.AngleBetween(vector1, vector2)
	return angle * math.sign(axisVector:Dot(vector1:Cross(vector2)))
end

function VectorUtil.SquaredMagnitude(vector)
	return vector.X^2+vector.Y^2+vector.Z^2
end


return VectorUtil
--[[Drivetrain Initialize]]



	local Front = bike.FrontSection
	local Rear = bike.RearSection
	
	--Determine Wheel Size
	local wDia = 0
	wDia = Rear.Wheel.Size.Y
	
	--Pre-Toggled PBrake
	if math.abs(Front.Axle.HingeConstraint.MotorMaxTorque-PBrakeForce)<1 then _PBrake=true end
--for _, item in ipairs(Shield:GetChildren()) do
--	if item:IsA("BasePart") == true and item:FindFirstChild("Ignore") == nil then
--		item.Touched:connect(function(Hit)
--			if Hit == nil then return end
--			if Hit.Parent == nil then return end
--			
--			local Item = Hit.Parent
--			
--			if Item:IsA("Tool") == true then return end
--			if Hit.Name == "Torso" then return end
--			if Hit.Name == "HumanoidRootPart" then return end
--			if Hit.Name == "Left Leg" then return end
--			if Hit.Name == "Right Leg" then return end
--			if Hit.Name == "Head" then return end
--			if Hit.Name == "Left Arm" then return end
--			if Hit.Name == "Right Arm" then return end
--			
--			if Game:GetService("Players"):GetPlayerFromCharacter(Item) ~= nil then return end
--			
--			for _, x in ipairs(Hit:GetChildren()) do
--				if x:IsA("TouchTransmitter") == true then x:Destroy() break end
--			end
--			
--			if Item.Name == "ShadowGrab" then
--				Health = Health - (MaxHealth / 12)
--				
--				HealthBar.Shield.Bar:TweenSize(UDim2.new((Health / MaxHealth), 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5, true)									
--				
--				Item:Destroy()
--				
--				if Health > 0 then
--					-- yay, still alive.
--				else
--					HealthBar.Parent.Parent:Destroy()
--				end
--			end
--		end)
--	end
--end



function CreateRegion3FromLocAndSize(Position, Size)
	local SizeOffset = Size / 2
	local Point1 = Position - SizeOffset
	local Point2 = Position + SizeOffset
	return Region3.new(Point1, Point2)
end

function FindNear(part, radius)
	local r = CreateRegion3FromLocAndSize(part.Position, Vector3.new(part.Size.X + radius, 50, part.Size.Z + radius))
	
	return Game:GetService("Workspace"):FindPartsInRegion3(r, part, 100)
end

while true do
	for _, x in ipairs(Shield:GetChildren()) do
		if x:IsA("BasePart") == true and x.Name ~= "Overhead" and x:FindFirstChild("Ignore") == nil then
			for _, item in ipairs(FindNear(x, 15)) do
				if item:IsA("BasePart") == true then
					local own, dmg = GetOwnerAndDamage(item)
					
					if own ~= nil and dmg ~= nil and item:FindFirstChild("Pierce") == nil then
						if (item.Position - x.Position).magnitude <= 15 and item ~= x then
							if Health > 0 then
								if Health >= dmg then
									Health = Health - dmg
									
									HealthBar.Shield.Bar:TweenSize(UDim2.new((Health / MaxHealth), 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5, true)
									
									for _, b in ipairs(item:GetChildren()) do
										if b:IsA("TouchTransmitter") == true then b:Destroy() end
									end
									
									item:Destroy()
									
									if Health > 0 then
										-- yay, still alive.
									else
										HealthBar.Parent.Parent:Destroy()
									end
								else
									HealthBar.Parent.Parent:Destroy()
								end
							else
								HealthBar.Parent.Parent:Destroy()
							end
						end
					end
				end
			end
	
		end
	end
	
	Game:GetService("RunService").Stepped:wait()
end
--[=[
	@param instance Instance
	@return Promise
]=]


function PromiseInstanceUtils.promiseRemoved(instance)
	assert(instance:IsDescendantOf(game))

	local maid = Maid.new()

	local promise = Promise.new()

	maid:GiveTask(instance.AncestryChanged:Connect(function(_, parent)
		if not parent then
			promise:Resolve()
		end
	end))

	promise:Finally(function()
		maid:DoCleaning()
	end)

	return promise
end

return PromiseInstanceUtils
-- Trove
-- Stephen Leitnick
-- October 16, 2021



local FN_MARKER = newproxy()
local THREAD_MARKER = newproxy()

local RunService = game:GetService("RunService")

local function GetObjectCleanupFunction(object, cleanupMethod)
	local t = typeof(object)
	if t == "function" then
		return FN_MARKER
	elseif t == "thread" then
		return THREAD_MARKER
	end
	if cleanupMethod then
		return cleanupMethod
	end
	if t == "Instance" then
		return "Destroy"
	elseif t == "RBXScriptConnection" then
		return "Disconnect"
	elseif t == "table" then
		if typeof(object.Destroy) == "function" then
			return "Destroy"
		elseif typeof(object.Disconnect) == "function" then
			return "Disconnect"
		end
	end
	error("Failed to get cleanup function for object " .. t .. ": " .. tostring(object), 3)
end

local function AssertPromiseLike(object)
	if
		type(object) ~= "table"
		or type(object.getStatus) ~= "function"
		or type(object.finally) ~= "function"
		or type(object.cancel) ~= "function"
	then
		error("Did not receive a Promise as an argument", 3)
	end
end
-- ================================================================================
-- EVENTS
-- ================================================================================


local onRaceStartedEvent = Instance.new("BindableEvent")
RaceModule.RaceStarted = onRaceStartedEvent.Event 

local onRaceFinishedEvent = Instance.new("BindableEvent")
RaceModule.RaceFinished = onRaceFinishedEvent.Event
RaceModule.OnRaceFinishedEvent = onRaceFinishedEvent

local onLapStartedEvent = Instance.new("BindableEvent")
RaceModule.LapStarted = onLapStartedEvent.Event

local onLapFinishedEvent = Instance.new("BindableEvent")
RaceModule.LapFinished = onLapFinishedEvent.Event

local onIntermissionStartedEvent = Instance.new("BindableEvent")
RaceModule.IntermissionStarted = onIntermissionStartedEvent.Event

local onCheckpointPassedEvent = Instance.new("BindableEvent")
RaceModule.CheckpointPassed = onCheckpointPassedEvent.Event
-- ROBLOX deviation END



exports.default = function(snapshots: SnapshotSummary, globalConfig: Config_GlobalConfig, updateCommand: string)
	local summary = {}
	table.insert(summary, SNAPSHOT_SUMMARY("Snapshot Summary"))

	if Boolean.toJSBoolean(snapshots.added) then
		table.insert(
			summary,
			SNAPSHOT_ADDED(ARROW .. pluralize("snapshot", snapshots.added) .. " written ")
				.. "from "
				.. pluralize("test suite", snapshots.filesAdded)
				.. "."
		)
	end

	if Boolean.toJSBoolean(snapshots.unmatched) then
		table.insert(
			summary,
			FAIL_COLOR(ARROW .. pluralize("snapshot", snapshots.unmatched) .. " failed")
				.. " from "
				.. pluralize("test suite", snapshots.filesUnmatched)
				.. ". "
				.. SNAPSHOT_NOTE("Inspect your code changes or " .. updateCommand .. " to update them.")
		)
	end

	if Boolean.toJSBoolean(snapshots.updated) then
		table.insert(
			summary,
			SNAPSHOT_UPDATED(ARROW .. pluralize("snapshot", snapshots.updated) .. " updated ")
				.. "from "
				.. pluralize("test suite", snapshots.filesUpdated)
				.. "."
		)
	end

	if Boolean.toJSBoolean(snapshots.filesRemoved) then
		if snapshots.didUpdate then
			table.insert(
				summary,
				SNAPSHOT_REMOVED(ARROW .. pluralize("snapshot file", snapshots.filesRemoved) .. " removed ")
					.. "from "
					.. pluralize("test suite", snapshots.filesRemoved)
					.. "."
			)
		else
			table.insert(
				summary,
				OBSOLETE_COLOR(ARROW .. pluralize("snapshot file", snapshots.filesRemoved) .. " obsolete ")
					.. "from "
					.. pluralize("test suite", snapshots.filesRemoved)
					.. ". "
					.. SNAPSHOT_NOTE(
						"To remove "
							.. (if snapshots.filesRemoved == 1 then "it" else "them all")
							.. ", "
							.. updateCommand
							.. "."
					)
			)
		end
	end

	if snapshots.filesRemovedList and #snapshots.filesRemovedList > 0 then
		local head = snapshots.filesRemovedList[1]
		local tail = table.pack(table.unpack(snapshots.filesRemovedList, 2))
		table.insert(summary, "  " .. DOWN_ARROW .. " " .. DOT .. formatTestPath(globalConfig, head))
		Array.forEach(tail, function(key)
			table.insert(summary, "    " .. DOT .. formatTestPath(globalConfig, key))
		end)
	end

	if Boolean.toJSBoolean(snapshots.unchecked) then
		if snapshots.didUpdate then
			table.insert(
				summary,
				SNAPSHOT_REMOVED(ARROW .. pluralize("snapshot", snapshots.unchecked) .. " removed ")
					.. "from "
					.. pluralize("test suite", #snapshots.uncheckedKeysByFile)
					.. "."
			)
		else
			table.insert(
				summary,
				OBSOLETE_COLOR(ARROW .. pluralize("snapshot", snapshots.unchecked) .. " obsolete ")
					.. "from "
					.. pluralize("test suite", #snapshots.uncheckedKeysByFile)
					.. ". "
					.. SNAPSHOT_NOTE(
						"To remove "
							.. (if snapshots.unchecked == 1 then "it" else "them all")
							.. ", "
							.. updateCommand
							.. "."
					)
			)
		end
	end

	Array.forEach(snapshots.uncheckedKeysByFile, function(uncheckedFile)
		table.insert(summary, "  " .. DOWN_ARROW .. formatTestPath(globalConfig, uncheckedFile.filePath))

		Array.forEach(uncheckedFile.keys, function(key)
			table.insert(summary, "    " .. DOT .. key)
		end)
	end)

	return summary
end

return exports
--// This section of code waits until all of the necessary RemoteEvents are found in EventFolder.
--// I have to do some weird stuff since people could potentially already have pre-existing
--// things in a folder with the same name, and they may have different class types.
--// I do the useEvents thing and set EventFolder to useEvents so I can have a pseudo folder that
--// the rest of the code can interface with and have the guarantee that the RemoteEvents they want
--// exist with their desired names.



local FILTER_MESSAGE_TIMEOUT = 60

local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Chat = game:GetService("Chat")
local StarterGui = game:GetService("StarterGui")

local DefaultChatSystemChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local EventFolder = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local ChatConstants = require(clientChatModules:WaitForChild("ChatConstants"))
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local messageCreatorModules = clientChatModules:WaitForChild("MessageCreatorModules")
local MessageCreatorUtil = require(messageCreatorModules:WaitForChild("Util"))

local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization) end)
if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end end

local numChildrenRemaining = 10 -- #waitChildren returns 0 because it's a dictionary
local waitChildren =
{
	OnNewMessage = "RemoteEvent",
	OnMessageDoneFiltering = "RemoteEvent",
	OnNewSystemMessage = "RemoteEvent",
	OnChannelJoined = "RemoteEvent",
	OnChannelLeft = "RemoteEvent",
	OnMuted = "RemoteEvent",
	OnUnmuted = "RemoteEvent",
	OnMainChannelSet = "RemoteEvent",

	SayMessageRequest = "RemoteEvent",
	GetInitDataRequest = "RemoteFunction",
}
--[[Driver Handling]]


	--Driver Sit	
	car.DriveSeat.ChildAdded:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
			--Distribute Client Interface
			local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
			car.DriveSeat:SetNetworkOwner(p)
			local g=script.Parent["A-Chassis Interface"]:Clone()
			g.Parent=p.PlayerGui
		end
	end)
	
	--Driver Leave
	car.DriveSeat.ChildRemoved:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") then
			--Remove Flip Force
			if car.DriveSeat:FindFirstChild("Flip")~=nil then
				car.DriveSeat.Flip.MaxTorque = Vector3.new()
			end
			
			--Remove Wheel Force
			for i,v in pairs(car.Wheels:GetChildren()) do
				if v:FindFirstChild("#AV")~=nil then
					if v["#AV"]:IsA("BodyAngularVelocity") then
						if v["#AV"].AngularVelocity.Magnitude>0 then
							v["#AV"].AngularVelocity = Vector3.new()
							v["#AV"].MaxTorque = Vector3.new()
						end
					else
						if v["#AV"].AngularVelocity>0 then
							v["#AV"].AngularVelocity = 0
							v["#AV"].MotorMaxTorque = 0
						end
					end
				end
			end
		end
	end)
-- functions



function stopAllAnimations()
	local oldAnim = currentAnim

	-- return to idle if finishing an emote
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
		oldAnim = "idle"
	end

	currentAnim = ""
	if (currentAnimKeyframeHandler ~= nil) then
		currentAnimKeyframeHandler:disconnect()
	end

	if (oldAnimTrack ~= nil) then
		oldAnimTrack:Stop()
		oldAnimTrack:Destroy()
		oldAnimTrack = nil
	end
	if (currentAnimTrack ~= nil) then
		currentAnimTrack:Stop()
		currentAnimTrack:Destroy()
		currentAnimTrack = nil
	end
	return oldAnim
end

function setAnimationSpeed(speed)
	if speed ~= currentAnimSpeed then
		currentAnimSpeed = speed
		currentAnimTrack:AdjustSpeed(currentAnimSpeed)
	end
end

function keyFrameReachedFunc(frameName)
	if (frameName == "End") then
-- Gui


local DisplayGui = script:WaitForChild("DisplayGui")
local ColorGui = script:WaitForChild("ColorGui")
local NewDisplayGui = nil
local NewColorGui = nil

function UndoSettings(Folder)
	for _,v in pairs(Folder:GetChildren()) do
		if v:IsA("NumberValue") or v:IsA("IntValue") then
			v.Value = 0
		elseif v:IsA("ObjectValue") and v.Name ~= "SpawnedSegway" then
			v.Value = nil
		end
	end
end

function RemoveSegway()
	-- Remove segway
	DestroySegway:FireServer(Character,SpawnedSegway)
	
	-- Reset camera
	Camera.CameraType = "Custom"
	
	-- Show tool
	ConfigTool:FireServer(0,Tool,false,nil)
	
	-- Undo tags anyway
	HasSpawnedSegway.Value = false

	-- UnPlatformStand player
	ConfigHumanoid:FireServer(Humanoid,false,false,true)
	
		-- If player has the segway controller script, we'll reset its settings
		if PlayerGui:FindFirstChild("GuiControls") then -- Remove mobile gui
		PlayerGui:FindFirstChild("GuiControls").Parent = script
		end
		UserInputService.ModalEnabled = false
		UndoSettings(ToolStatus)
end
--[=[
	Constructs a new DataStore. See [DataStoreStage] for more API.
	@param robloxDataStore DataStore
	@param key string
]=]


function DataStore.new(robloxDataStore, key)
	local self = setmetatable(DataStoreStage.new(), DataStore)

	self._key = key or error("No key")
	self._robloxDataStore = robloxDataStore or error("No robloxDataStore")