Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 242		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		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	= 4.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)
--Services


tweenService = game:GetService("TweenService")

repeat wait() until game.Players.LocalPlayer.tempStage


game.Players.LocalPlayer.tempStage.Value = game.Players.LocalPlayer.leaderstats.Stage.Value

script.Parent.Text = tostring(game.Players.LocalPlayer.tempStage.Value)

game.Players.LocalPlayer.leaderstats.Stage.Changed:Connect(function()
	game.Players.LocalPlayer.tempStage.Value = game.Players.LocalPlayer.leaderstats.Stage.Value
	script.Parent.Text = tostring(game.Players.LocalPlayer.tempStage.Value)
	script.Parent.Sound:Play()
end)

game.Players.LocalPlayer.tempStage.Changed:Connect(function()
	script.Parent.Text = tostring(game.Players.LocalPlayer.tempStage.Value)
end)
-- Basic settings


local COOLDOWN_TIME = 25
local RUNTIME = 10

local plr = game.Players.LocalPlayer
local inputService = game:GetService("UserInputService")

game.ReplicatedStorage.Interactions.Client.Perks.UseInvisibility.OnClientEvent:connect(function()
	
	-- Make sure character is alive
	if plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") then
		
		-- Show tip
		plr.PlayerGui.MainGui.Tip.Text = "Press Q to turn invisible"
		
		-- Set map object
		local map = workspace:FindFirstChild("Map")
	
		-- Listen for keypress
		local debounce = false
		local event
		local done = false
		event = inputService.InputBegan:connect(function(inputObj)
			
			-- Check if states are correct
			if inputObj.KeyCode == Enum.KeyCode.Q and not debounce and not done and workspace:FindFirstChild("Map") == map then
				debounce = true
				
				-- Tell server to make invisible
				game.ReplicatedStorage.Interactions.Server.Perks.MakeInvisible:FireServer()
				
				-- Update text to match state
				for i=1, RUNTIME do
					if done or workspace:FindFirstChild("Map") == nil then
						break
					end
					plr.PlayerGui.MainGui.Tip.Text = "Invisible for " .. (RUNTIME - i + 1) .. " seconds"
					wait(1)
				end
				if not done and workspace:FindFirstChild("Map") then
					for i=1, COOLDOWN_TIME do
						if done or workspace:FindFirstChild("Map") == nil then
							break
						end
						plr.PlayerGui.MainGui.Tip.Text = "Can use again in " .. (COOLDOWN_TIME - i + 1) .. " seconds"
						wait(1)
					end
					if not done and workspace:FindFirstChild("Map") then
						plr.PlayerGui.MainGui.Tip.Text = "Press Q to turn invisible"
					end
				end
				if done or workspace:FindFirstChild("Map") == nil then
					if event ~= nil then
						event:disconnect()
						event = nil
					end
					done = true
					plr.PlayerGui.MainGui.Tip.Text = ""
				end
				
				debounce = false
			elseif workspace:FindFirstChild("Map") ~= map then
				if event ~= nil then
					event:disconnect()
					event = nil
				end
				done = true
				plr.PlayerGui.MainGui.Tip.Text = ""
			end
			
		end)
		
		-- Connect character death
		plr.Character.Humanoid.Died:connect(function()
			if not done then
				event:disconnect()
				event = nil
				done = true
				plr.PlayerGui.MainGui.Tip.Text = ""
			end
		end)
		
	end
	
end)
-- From TransparencyController


function CameraUtils.Round(num: number, places: number): number
	local decimalPivot = 10^places
	return math.floor(num * decimalPivot + 0.5) / decimalPivot
end

function CameraUtils.IsFinite(val: number): boolean
	return val == val and val ~= math.huge and val ~= -math.huge
end

function CameraUtils.IsFiniteVector3(vec3: Vector3): boolean
	return CameraUtils.IsFinite(vec3.X) and CameraUtils.IsFinite(vec3.Y) and CameraUtils.IsFinite(vec3.Z)
end
--[[
	Removes a Spring from the scheduler.
]]


function SpringScheduler.remove(spring: Spring)
	local damping = spring._damping
	local speed = spring._speed

	local dampingBucket = springBuckets[damping]

	if dampingBucket == nil then
		return
	end

	local speedBucket = dampingBucket[speed]

	if speedBucket == nil then
		return
	end

	speedBucket[spring] = nil
end
--//Jumping


local jumps = 0
local function ToggleFlying()
	if hum.FloorMaterial == Enum.Material.Air then --Is double jumping
		if jumps >= settings.ExtraJumps then return end
		jumps += 1
		
		hum:ChangeState(Enum.HumanoidStateType.Jumping) --Jump
		event:FireServer() --Tell other players that we are double jumping
		
		JumpEffect(char) --Visual Effect
	end
end
hum.StateChanged:connect(function(old, new) --Player landed
	if new == Enum.HumanoidStateType.Landed then
		jumps = 0
	end
end)
--!nolint UnknownGlobal
--[[
	SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-"
	CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-"
	
	Plugins have full access to the server/client tables and most variables.
	
	You can use the MakePluginEvent to use the script instead of setting up an event.
	PlayerChatted will get chats from the custom chat and nil players. 
	PlayerJoined will fire after the player finishes initial loading
	CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
	
	service.HookEvent('PlayerChatted',function(msg,plr) 
		print(msg..' from '..plr.Name..' Example Plugin')
	end)
	
	service.HookEvent('PlayerJoined',function(p) 
		print(p.Name..' Joined! Example Plugin') 
	end)
	
	service.HookEvent('CharacterAdded',function(plr) 
		server.RunCommand('name',plr.Name,'BobTest Example Plugin') 
	end)
	
--]]



return function()
	server.Commands.ExampleCommand = {
		Prefix = server.Settings.Prefix;	-- Prefix to use for command
		Commands = {"example"};	-- Commands
		Args = {"arg1"};	-- Command arguments
		Description = "Example command";	-- Command Description
		Hidden = true; -- Is it hidden from the command list?
		Fun = false;	-- Is it fun?
		AdminLevel = "Players";	    -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
		Function = function(plr,args)    -- Function to run for command
			print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
			print("Player supplied args[1] "..tostring(args[1]))
		end
	}
end
--Apply Vehicle Weight


if mass<_Tune.Weight*weightScaling then
	--Calculate Weight Distribution
	local center = rWheel.CFrame.p:Lerp(fWheel.CFrame.p, _Tune.WeightDistribution/100)  
	
	--Create Weight Brick
	weightB = Instance.new("Part",bike.Body)
	weightB.Name = "Weight"
	weightB.Anchored = true
	weightB.CanCollide = false
	weightB.BrickColor = BrickColor.new("Really black")
	weightB.TopSurface = Enum.SurfaceType.Smooth
	weightB.BottomSurface = Enum.SurfaceType.Smooth
	if _Tune.WBVisible or _Tune.Debug then
		weightB.Transparency = .75			
	else
		weightB.Transparency = 1			
	end
	weightB.Size = Vector3.new(_Tune.WeightBrickSize[1],_Tune.WeightBrickSize[2],_Tune.WeightBrickSize[3])
	weightB.CustomPhysicalProperties = PhysicalProperties.new(((_Tune.Weight*weightScaling)-mass)/(weightB.Size.x*weightB.Size.y*weightB.Size.z),0,0,0,0)
	weightB.CFrame=(bike.DriveSeat.CFrame-bike.DriveSeat.Position+center)*CFrame.new(0,_Tune.CGHeight,0)
else
	--Existing Weight Is Too Massive
	warn( "\n\t [NCT: M] Mass too high for specified weight."
		.."\n\t    Target Mass:\t"..(math.ceil(_Tune.Weight*weightScaling*100)/100)
		.."\n\t    Current Mass:\t"..(math.ceil(mass*100)/100))
end
--[[
	    ___      _______                _       _______
	   / _ |____/ ___/ /  ___ ____ ___ (_)__   /__  __/
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<     / /
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/	/_/   
						SecondLogic @ Inspare
						Avxnturador @ Novena
]]




local autoscaling	= true					--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		= 230				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 370				,
		spInc			= 40				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 400				,
		spInc			= 40				, -- Increment between labelled notches
	}
}
-- waitChildren/EventFolder does not contain all the remote events, because the server version could be older than the client version.
-- In that case it would not create the new events.
-- These events are accessed directly from DefaultChatSystemChatEvents



local useEvents = {}

local FoundAllEventsEvent = Instance.new("BindableEvent")

function TryRemoveChildWithVerifyingIsCorrectType(child)
	if (waitChildren[child.Name] and child:IsA(waitChildren[child.Name])) then
		waitChildren[child.Name] = nil
		useEvents[child.Name] = child
		numChildrenRemaining = numChildrenRemaining - 1
	end
end

for i, child in pairs(EventFolder:GetChildren()) do
	TryRemoveChildWithVerifyingIsCorrectType(child)
end

if (numChildrenRemaining > 0) then
	local con = EventFolder.ChildAdded:connect(function(child)
		TryRemoveChildWithVerifyingIsCorrectType(child)
		if (numChildrenRemaining < 1) then
			FoundAllEventsEvent:Fire()
		end
	end)

	FoundAllEventsEvent.Event:wait()
	con:disconnect()

	FoundAllEventsEvent:Destroy()
end

EventFolder = useEvents
-- Explicit dependencies are dependencies that are are explicitly listed.
-- These dependencies are available to this package and ANY dependent packages below


function PackageInfoUtils.fillExplicitPackageDependencySet(
	explicitDependencySet, packageFolder, packageInfoMap, defaultReplicationType)

	assert(type(explicitDependencySet) == "table", "Bad explicitDependencySet")
	assert(typeof(packageFolder) == "Instance", "Bad packageFolder")
	assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
	assert(defaultReplicationType, "No defaultReplicationType")

	for _, item in pairs(packageFolder:GetChildren()) do
		if item:IsA("Folder") and item.Name == ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then
			local packageInfoList = PackageInfoUtils.getPackageInfoListFromDependencyFolder(
				item,
				packageInfoMap,
				defaultReplicationType)

			for _, packageInfo in pairs(packageInfoList) do
				explicitDependencySet[packageInfo] = true
			end
		end
	end
end

return PackageInfoUtils
-- Class



local Portal = {}
Portal.__index = Portal

function Portal.new(humanoid, windowA, windowB, cameraModule)
	local self = setmetatable({}, Portal)
	
	self.Humanoid = humanoid
	self.HRP = humanoid.RootPart
	self.LastPosition = self.HRP.Position
	self.TeleportTick = tick()
	
	self.WindowA = windowA
	self.WindowB = windowB
	
	self.World = nil
	self.WorldLookupA = {}
	self.WorldLookupB = {}
	self.CharacterLookups = {}
	
	self.Sky = nil
	self.SkyA = nil
	self.SkyB = nil
	
	self.CameraModule = cameraModule
	self.LastCameraCFrame = workspace.CurrentCamera.CFrame
	self.LastCameraFocus = workspace.CurrentCamera.Focus
	
	RUNSERVICE:BindToRenderStep("PortalBeforeInput", Enum.RenderPriority.Input.Value - 1, function(dt)
		workspace.CurrentCamera.CFrame = self.LastCameraCFrame
		workspace.CurrentCamera.Focus = self.LastCameraFocus
	end)
	
	RUNSERVICE:BindToRenderStep("PortalAfterCamera", Enum.RenderPriority.Camera.Value + 1, function(dt)
		self:OnAfterCameraStep(dt)
	end)
	
	return self
end
--Scripted by DermonDarble



local character = script.Parent.Parent
local humanoid = character:WaitForChild("Humanoid")
local animations = {}

for i, animation in pairs(character:WaitForChild("Animations"):GetChildren()) do
	animations[animation.Name] = humanoid:LoadAnimation(animation)
end

local state = "None"

local function Grounded()
	local ray = Ray.new(character.HumanoidRootPart.Position + Vector3.new(0, -4.3, 0), Vector3.new(0, -1, 0))
	local hit, position = game.Workspace:FindPartOnRay(ray, character)
	if hit and hit.CanCollide then
		return(true)
	else
		return(false)
	end
end

local function StopAll()
	for i, animation in pairs(animations) do
		animation:Stop()
	end
end

local function ChangeState(newState)
	if state ~= newState then
		StopAll()
		state = newState
		if animations[state] then
			animations[state]:Play()
		end
	end
end

while true do
	game:GetService("RunService").Stepped:wait()
	if humanoid.Health > 0 then
		if Grounded() then
			local speed = Vector3.new(character.HumanoidRootPart.Velocity.X, 0, character.HumanoidRootPart.Velocity.Z).magnitude
			if speed > 1 then
				ChangeState("Walk")
			else
				ChangeState("Idle")
			end
		else
			local ySpeed = character.HumanoidRootPart.Velocity.Y
			if ySpeed > 0 then
				ChangeState("Jump")
			else
				ChangeState("Fall")
			end
		end
	else
		ChangeState("Dead")
	end
end
-- Basic settings


local ROTATION_SPEED = 0.1
local tweenService = game:GetService("TweenService")

while true do
	
	-- Wait
	local waitTime = wait()
	
	-- Tween to rotate
	local goal = {
		CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, ROTATION_SPEED, 0)
	}
	tweenService:Create(script.Parent, TweenInfo.new(waitTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), goal):Play()
	
end
-- Split a filename into [root, dir, basename]


function Path:_splitPath(filename: string)
	filename = self:normalizeSeparators(filename)
	local root = ""
	if self:isAbsolute(filename) or self:isDriveRelative(filename) then
		root = self:getRoot(filename)
		filename = filename:sub(root:len() + 1)
	end
	local trailing_slashes = filename:match("[" .. self.sep .. "]*$")
	if trailing_slashes then
		filename = filename:sub(1, -trailing_slashes:len() - 1)
	end
	local basename = filename:match("[^" .. self.sep .. "]+$") or ""
	local dir = basename and filename:sub(1, -basename:len() - 1) or filename
	return root, dir, basename
end
-- Main input to buffer.


function ChangeBuffer:align(diff: Diff): ()
	local s = diff[2]

	if s:match("\n") then
		local substrings = s:split("\n")
		-- ROBLOX deviation: 1-indexing
		local iLast = #substrings
		for i, substring in ipairs(substrings) do
			if i < iLast then
				-- The first substring completes the current change line.
				-- A middle substring is a change line.
				self:pushSubstring(substring)
				self:pushLine()
			elseif #substring ~= 0 then
				-- The last substring starts a change line, if it is not empty.
				-- Important: This non-empty condition also automatically omits
				-- the newline appended to the end of expected and received strings.
				self:pushSubstring(substring)
			end
		end
	else
		-- Append non-multiline string to current change line.
		self:pushDiff(diff)
	end
end
--				{ id = "slash.xml", weight = 10 } 


			},
	toollunge = {
				{ id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } 
			},
	wave = {
				{ id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } 
			},
	point = {
				{ id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } 
			},
	dance = {
				{ id = "http://www.roblox.com/asset/?id=182435998", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=182491037", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=182491065", weight = 10 } 
			},
	dance2 = {
				{ id = "http://www.roblox.com/asset/?id=182436842", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=182491248", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=182491277", weight = 10 } 
			},
	dance3 = {
				{ id = "http://www.roblox.com/asset/?id=182436935", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=182491368", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=182491423", weight = 10 } 
			},
	laugh = {
				{ id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } 
			},
	cheer = {
				{ id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } 
			},
}
--F.reverseLights = function(Tog)
--	for i,v in pairs(script.Parent.Parent.Parent:getChildren()) do
--		if v:FindFirstChild('Reverse') then
--			v.Braking.Enabled = (carSeat.Ignition.Value == 1 and Tog or false)
--			v.Lights.Enabled = (carSeat.Ignition.Value == 1 and Tog or false)
--		end
--	end
--end
-- Etc


local DESTROY_ON_DEATH = getValueFromConfig("DestroyOnDeath")
local RAGDOLL_ENABLED = getValueFromConfig("RagdollEnabled")

local DEATH_DESTROY_DELAY = 1
local PATROL_WALKSPEED = 16
local MIN_REPOSITION_TIME = 1
local MAX_REPOSITION_TIME = 5
local MAX_PARTS_PER_HEARTBEAT = 50
local ATTACK_STAND_TIME = 1
local HITBOX_SIZE = Vector3.new(5, 3, 5)
local SEARCH_DELAY = 1
local ATTACK_RANGE = 5
local ATTACK_DELAY = 1
local ATTACK_MIN_WALKSPEED = 16
local ATTACK_MAX_WALKSPEED = 36
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote


local emoteNames: { [string]: boolean } =
	{ }

function configureAnimationSet(name: string, fileList: { { id: string, weight: number } })
	if animTable[name] ~= nil then
		for _, connection in ipairs(animTable[name].connections) do
			connection:Disconnect()
		end
	end

	animTable[name] = {} :: any
	animTable[name].count = 0
	animTable[name].totalWeight = 0
	animTable[name].connections = {}

	-- check for config values
	local config = script:FindFirstChild(name)
	if config ~= nil then
		--		print("Loading anims " .. name)
		table.insert(
			animTable[name].connections,
			config.ChildAdded:Connect(function(child)
				configureAnimationSet(name, fileList)
			end)
		)

		table.insert(
			animTable[name].connections,
			config.ChildRemoved:Connect(function(child)
				configureAnimationSet(name, fileList)
			end)
		)

		local idx = 1
		for _, childPart in ipairs(config:GetChildren()) do
			if childPart:IsA("Animation") then
				table.insert(
					animTable[name].connections,
					childPart.Changed:Connect(function(property)
						configureAnimationSet(name, fileList)
					end)
				)

				animTable[name][idx] = {} :: any
				animTable[name][idx].anim = childPart

				local weightObject = childPart:FindFirstChild("Weight")
				if weightObject == nil then
					animTable[name][idx].weight = 1
				else
					animTable[name][idx].weight = weightObject.Value
				end

				animTable[name].count = animTable[name].count + 1
				animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
				--			print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
				idx = idx + 1
			end
		end
	end

	-- fallback to defaults
	if animTable[name].count <= 0 then
		for idx, anim in ipairs(fileList) do
			animTable[name][idx] = {} :: any
			animTable[name][idx].anim = Instance.new("Animation")
			animTable[name][idx].anim.Name = name
			animTable[name][idx].anim.AnimationId = anim.id
			animTable[name][idx].weight = anim.weight
			animTable[name].count = animTable[name].count + 1
			animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
			--			print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
		end
	end
end
--followPath(destination)
-------------------------------------------------------------------
-------------------------------------------------------------------
-------------------------------------------------------------------




function AI()

	if Mode == 0 then
			--waypoint = nil
			--print("Patrol mode")
			wait(math.random(5,15)/10)
			followPath(hroot.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)))

			--human:MoveTo(zombie.Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)

	elseif Mode == 1 then

		target = findNearestTorso(hroot.Position)

		if target ~= nil then
		if CanSee == true and (hroot.Position - target.Position).Magnitude <= MinDistance then
			waypoint = nil
		else
			
		path:ComputeAsync(hroot.Position, target.Position)
		waypoint = path:GetWaypoints()

		local connection;
		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
		if path.Status == Enum.PathStatus.Success then
			--print("Chasing "..target.Parent.Name)
			human.WalkToPart = nil
		if  waypoint or checkw(waypoint) then
			if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
				human:MoveTo( checkw(waypoint).Position)
			end
			
			
			if connection then
				connection:Disconnect()
			end
			
		else
			for i = 3, #waypoint do
				human:MoveTo( waypoint[i].Position )	
			end
		end
		else
			--print("No Path,Patrolling")
			wait(math.random(5,15)/10)
			followPath(hroot.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)))

		end
		end
		end
	elseif Mode == 2 then

		target = findNearestTorso(hroot.Position)

		if target ~= nil then
		if CanSee == true and (hroot.Position - target.Position).Magnitude <= MinDistance then
			waypoint = {}
			waypoint = nil
		else
			
		path:ComputeAsync(hroot.Position, target.Position)
		waypoint = path:GetWaypoints()

		local connection;
		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
		if path.Status == Enum.PathStatus.Success and Memory > 0 then
			--print("Chasing "..target.Parent.Name)
			human.WalkToPart = nil
			if  waypoint or checkw(waypoint) then
				if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
					human:MoveTo( checkw(waypoint).Position )
				end
			
			
				if connection then
					connection:Disconnect()
				end
			
			else
				for i = 3, #waypoint do
					human:MoveTo( waypoint[i].Position )	
				end
			end
		else
			waypoint = nil
			--print("No Path,Patrolling")
			wait(math.random(5,15)/10)
			followPath(hroot.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)))

		end
		end
		end
	elseif Mode == 3 then
		--	print("Guarding")
	end	
end
--[=[
	Saves all stored data.
	@return Promise
]=]


function DataStore:Save()
	if self:DidLoadFail() then
		warn("[DataStore] - Not saving, failed to load")
		return Promise.rejected("Load not successful, not saving")
	end

	if DEBUG_WRITING then
		print("[DataStore.Save] - Starting save routine")
	end

	-- Avoid constructing promises for every callback down the datastore
	-- upon save.
	return (self:_promiseInvokeSavingCallbacks() or Promise.resolved())
		:Then(function()
			if not self:HasWritableData() then
				-- Nothing to save, don't update anything
				if DEBUG_WRITING then
					print("[DataStore.Save] - Not saving, nothing staged")
				end
				return nil
			else
				return self:_saveData(self:GetNewWriter())
			end
		end)
end