Pinkstack/roblox-luau-corpus-text huggingface dataset:
--// This method is to be used with the new filter API. This method takes the
--// TextFilterResult objects and converts them into the appropriate string
--// messages for each player.


function methods:InternalSendFilteredMessageWithFilterResult(inMessageObj, channelName)
	local messageObj = ShallowCopy(inMessageObj)

	local oldFilterResult = messageObj.FilterResult
	local player = self:GetPlayer()

	local msg = ""
	pcall(function()
		if (messageObj.IsFilterResult) then
			if (player) then
				msg = oldFilterResult:GetChatForUserAsync(player.UserId)
			else
				msg = oldFilterResult:GetNonChatStringForBroadcastAsync()
			end
		else
			msg = oldFilterResult
		end
	end)

	--// Messages of 0 length are the result of two users not being allowed
	--// to chat, or GetChatForUserAsync() failing. In both of these situations,
	--// messages with length of 0 should not be sent.
	if (#msg > 0) then
		messageObj.Message = msg
		messageObj.FilterResult = nil
		self:InternalSendFilteredMessage(messageObj, channelName)
	end
end

function methods:InternalSendSystemMessage(messageObj, channelName)
	local success, err = pcall(function()
		self:LazyFire("eReceivedSystemMessage", messageObj, channelName)
		if self.PlayerObj then
			self.EventFolder.OnNewSystemMessage:FireClient(self.PlayerObj, messageObj, channelName)
		end
	end)
	if not success and err then
		print("Error sending internal system message: " ..err)
	end
end

function methods:UpdateChannelNameColor(channelName, channelNameColor)
	self:LazyFire("eChannelNameColorUpdated", channelName, channelNameColor)
	if self.PlayerObj then
		self.EventFolder.ChannelNameColorUpdated:FireClient(self.PlayerObj, channelName, channelNameColor)
	end
end
-- wandering 


spawn(function()
	while vars.Wandering.Value == false and human.Health > 0 do	
		vars.Chasing.Value = false	
		vars.Wandering.Value = true
		local desgx, desgz = hroot.Position.x+math.random(-WanderX,WanderX), hroot.Position.z+math.random(-WanderZ,WanderZ)
		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, Vector3.new(desgx, 0, desgz))
		waypoint = path:GetWaypoints()
		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
			
			if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Jump then
				connection = human.Changed:connect(function()
					human.Jump = true
				end)
				human:MoveTo( waypoint[4].Position )
			else
				human.Jump = false
			end
			
			if connection then
				connection:Disconnect()
			end
			
		else
			for i = 3, #waypoint do
				human:MoveTo( waypoint[i].Position )	
			end
		end
		wait(math.random(4,6))
		vars.Wandering.Value = false
	end
end)
--// All global vars will be wiped/replaced except script



return function(data)
	local playergui = service.PlayerGui
	local localplayer = service.Players.LocalPlayer
	local scr = client.UI.Prepare(script.Parent.Parent)
	local window = scr.Window
	local msg = data.Message
	local color = data.Color

	local found = client.UI.Get("Output")
	if found then
		for i,v in pairs(found) do
			local p = v.Object
			if p and p.Parent then
				p.Window.Position = UDim2.new(0.5, 0, 0.5, p.Window.Position.Y.Offset+160)
			end
		end
	end

	window.Main.ScrollingFrame.ErrorText.Text = msg
	window.Main.ScrollingFrame.ErrorText.TextColor3 = color

	window.Close.MouseButton1Down:Connect(function()
		gTable.Destroy()
	end)

	spawn(function()
		local sound = Instance.new("Sound",service.LocalContainer())
		sound.SoundId = "rbxassetid://160715357"
		sound.Volume = 2
		sound:Play()
		wait(0.8)
		sound:Destroy()
	end)

	gTable.Ready()
	wait(5)
	gTable.Destroy()
end
--[[
	
	CameraShakePresets.Bump
	CameraShakePresets.Explosion
	CameraShakePresets.Earthquake
	CameraShakePresets.BadTrip
	CameraShakePresets.HandheldCamera
	CameraShakePresets.Vibration
	CameraShakePresets.RoughDriving
	
--]]





local CameraShakeInstance = require(script.Parent.CameraShakeInstance)

local CameraShakePresets = {
	
	
	-- A high-magnitude, short, yet smooth shake.
	-- Should happen once.
	Bump = function()
		local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
		c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;
	
	
	-- An intense and rough shake.
	-- Should happen once.
	Explosion = function()
		local c = CameraShakeInstance.new(5, 10, 0,.8)
		c.PositionInfluence = Vector3.new(.5,.5,.5)
		c.RotationInfluence = Vector3.new(1,1,1)
		return c
	end;
	
	
	-- A continuous, rough shake
	-- Sustained.
	Earthquake = function()
		local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
		c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
		c.RotationInfluence = Vector3.new(1, 1, 4)
		return c
	end;
	
	
	-- A bizarre shake with a very high magnitude and low roughness.
	-- Sustained.
	BadTrip = function()
		local c = CameraShakeInstance.new(10, 0.15, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0.15)
		c.RotationInfluence = Vector3.new(2, 1, 4)
		return c
	end;
	
	
	-- A subtle, slow shake.
	-- Sustained.
	HandheldCamera = function()
		local c = CameraShakeInstance.new(1, 0.25, 5, 10)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
		return c
	end;
	
	
	-- A very rough, yet low magnitude shake.
	-- Sustained.
	Vibration = function()
		local c = CameraShakeInstance.new(0.4, 20, 2, 2)
		c.PositionInfluence = Vector3.new(0, 0.15, 0)
		c.RotationInfluence = Vector3.new(1.25, 0, 4)
		return c
	end;
	
	
	-- A slightly rough, medium magnitude shake.
	-- Sustained.
	RoughDriving = function()
		local c = CameraShakeInstance.new(1, 2, 1, 1)
		c.PositionInfluence = Vector3.new(0, 0, 0)
		c.RotationInfluence = Vector3.new(1, 1, 1)
		return c
	end;
	
	
}


return setmetatable({}, {
	__index = function(t, i)
		local f = CameraShakePresets[i]
		if (type(f) == "function") then
			return f()
		end
		error("No preset found with index \"" .. i .. "\"")
	end;
})
---[[ Window Settings ]]


module.MinimumWindowSize = UDim2.new(0.3, 0, 0.25, 0)
module.MaximumWindowSize = UDim2.new(1, 0, 1, 0) -- if you change this to be greater than full screen size, weird things start to happen with size/position bounds checking.
module.DefaultWindowPosition = UDim2.new(0, 0, 0, 0)
local extraOffset = (7 * 2) + (5 * 2) -- Extra chatbar vertical offset
module.DefaultWindowSizePhone = UDim2.new(0.5, 0, 0.5, extraOffset)
module.DefaultWindowSizeTablet = UDim2.new(0.4, 0, 0.3, extraOffset)
module.DefaultWindowSizeDesktop = UDim2.new(0.3, 0, 0.25, extraOffset)
--		print(animName .. " * " .. idx .. " [" .. origRoll .. "]")


		local anim = animTable[animName][idx].anim

		if (toolAnimInstance ~= anim) then
			
			if (toolAnimTrack ~= nil) then
				toolAnimTrack:Stop()
				toolAnimTrack:Destroy()
				transitionTime = 0
			end
					
			-- load it to the humanoid; get AnimationTrack
			toolAnimTrack = humanoid:LoadAnimation(anim)
			if priority then
				toolAnimTrack.Priority = priority
			end
			 
			-- play the animation
			toolAnimTrack:Play(transitionTime)
			toolAnimName = animName
			toolAnimInstance = anim

			currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
		end
end

function stopToolAnimations()
	local oldAnim = toolAnimName

	if (currentToolAnimKeyframeHandler ~= nil) then
		currentToolAnimKeyframeHandler:disconnect()
	end

	toolAnimName = ""
	toolAnimInstance = nil
	if (toolAnimTrack ~= nil) then
		toolAnimTrack:Stop()
		toolAnimTrack:Destroy()
		toolAnimTrack = nil
	end


	return oldAnim
end
--Rear Suspension


Tune.RSusDamping	= 401		-- Spring Dampening
Tune.RSusStiffness	= 14000		-- Spring Force
Tune.FAntiRoll 		= 18.82		-- Anti-Roll (Gyro Dampening)

Tune.RSusLength		= 2			-- Suspension length (in studs)
Tune.RPreCompress	= .3		-- Pre-compression adds resting length force
Tune.RExtensionLim	= .3		-- Max Extension Travel (in studs)
Tune.RCompressLim	= .1		-- Max Compression Travel (in studs)
Tune.RSusAngle		= 54		-- Suspension Angle (degrees from horizontal)

Tune.RWsBoneLen		= 5			-- Wishbone Length
Tune.RWsBoneAngle	= 2			-- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	--[[Lateral]]		-.4		,	-- positive = outward
	--[[Vertical]]		-.5		,	-- positive = upward
	--[[Forward]]		0		}	-- positive = forward
-- you can mess with these settings


local easingtime = 0.1 --0~1
local walkspeeds = {
	enabled =		  true;
	walkingspeed =		16;
	backwardsspeed =	10;
	sidewaysspeed =		15;
	diagonalspeed =		16;
	runningspeed =		25;
	runningFOV=			85;
}
--[[



]]



local ReplicatedStorage = game:GetService("ReplicatedStorage")

local AvatarEditor = ReplicatedStorage.AvatarEditor
local GuiLib = require(AvatarEditor.Client.GuiLib.LazyLoader)
local Maid = require(AvatarEditor.Shared.Util.Maid)
local Signal = require(AvatarEditor.Shared.Util.Signal)
local Promise = require(AvatarEditor.Shared.Util.Promise)
local Settings = require(AvatarEditor.Shared.Settings)

local Class = {}
Class.__index = Class


function Class.new(frame, searchState)
	local self = setmetatable({}, Class)
	
	self.State = searchState
	self.SearchChanged = Signal.new()
	self.Maid = Maid.new()
	self.NextSearch = nil
	self.SearchPromise = nil
	self.Frame = frame
	
	local searchBox = frame.TextBox
	
	local mask = GuiLib.Classes.TextMask.new(searchBox)
	self.Maid:GiveTask(mask)

	mask:SetMaskType("String")
	mask:SetMaxLength(50)
	
	self.Maid:GiveTask(mask.Frame.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLoss)
		if not enterPressed then
			return
		end
		local value = mask:GetValue()
		self:OnSearchChanged(value, true)
	end))

	self.Maid:GiveTask(mask.Frame:GetPropertyChangedSignal("Text"):Connect(function()
		local value = mask:GetValue()
		self:OnSearchChanged(value)
	end))

	self.Maid:GiveTask(frame.Clear.Activated:Connect(function(inputObject)
		searchBox.Text = ""
	end))
	
	return self
end


function Class:OnSearchChanged(pattern, focusLost)
	local state = self.State
	local searchPromise = self.SearchPromise
	
	self.NextSearch = pattern

	if searchPromise then
		searchPromise:cancel()
	end
	-- cant believe this works
	self.SearchPromise = Promise.new(function(resolve, reject, onCancel)
		Promise.delay(Settings.SEARCH_DELAY):andThen(function()
			if not onCancel(function() end) then
				if state.search == self.NextSearch then
					reject("same search")
				else
					state.search = self.NextSearch
					self.SearchChanged:Fire()
					resolve()
				end
			end
		end)
	end):catch(function()

	end)
end


function Class:Destroy()
	self.State = nil
	self.SearchChanged:Destroy()
	self.SearchChanged = nil
	self.Maid:DoCleaning()
	self.Maid = nil
	self.NextSearch = nil
	self.SearchPromise = nil
	self.Frame = nil
	setmetatable(self, nil)
end


return Class
-- 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)).p

local start = tick()
repeat task.wait(1/2) 
local ray = Ray.new(banto.PrimaryPart.Position,Vector3.new(0,-1000,0))
--[[function pm(x)

	if game.Players:findFirstChild(script.Parent.Parent.Name)~=nil then
		local bob=game.Players:findFirstChild(script.Parent.Parent.Name)
		local mess=Instance.new("Message")
		while bob:findFirstChild("Message")~=nil do bob.Message:remove() end
		mess.Parent=bob
		if x==1 then
			mess.Text="I Chord"
		elseif x==2 then
			mess.Text="IV Chord"
		elseif x==3 then
			mess.Text="V Chord"
		elseif x==4 then
			mess.Text="V-VII Transition"
		elseif x==5 then
			mess.Text="I-VII Transition"
		elseif x==6 then
			mess.Text="III Chord"
		end
		wait(1)
		mess.Parent=nil
	end
end]]



function Leap()
wait(0.25)--Might want to change this
script.Parent.GripForward = Vector3.new(-0,-0,1)
script.Parent.GripPos = Vector3.new(-1, 0, 0)
script.Parent.GripRight = Vector3.new(-1, 0, 0)
script.Parent.GripUp = Vector3.new(0, 1, 0)
wait(0.75)--Might want to change this also...
script.Parent.GripForward = Vector3.new(-0.291, 0.485, 0.825)
script.Parent.GripPos = Vector3.new(-1.5, 0, 0)
script.Parent.GripRight = Vector3.new(-0.857, -0.514, 0)
script.Parent.GripUp = Vector3.new(-0.424, 0.707, -0.565)
end

script.Parent.Parent.Humanoid.Jumping:connect(Leap)
----------//Animation Loader\\----------


function EquipAnim()
	AnimDebounce = false
	pcall(function()
		AnimData.EquipAnim({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
	AnimDebounce = true
end


function IdleAnim()
	pcall(function()
		AnimData.IdleAnim({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
	AnimDebounce = true
end

function SprintAnim()
	AnimDebounce = false
	pcall(function()
		AnimData.SprintAnim({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function HighReady()
	pcall(function()
		AnimData.HighReady({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function LowReady()
	pcall(function()
		AnimData.LowReady({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function Patrol()
	pcall(function()
		AnimData.Patrol({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function ReloadAnim()
	pcall(function()
		AnimData.ReloadAnim({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function TacticalReloadAnim()
	pcall(function()
		AnimData.TacticalReloadAnim({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function JammedAnim()
	pcall(function()
		AnimData.JammedAnim({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function PumpAnim()
	reloading = true
	pcall(function()
		AnimData.PumpAnim({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
	reloading = false
end

function MagCheckAnim()
	CheckingMag = true
	pcall(function()
		AnimData.MagCheck({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
	CheckingMag = false
end

function meleeAttack()
	pcall(function()
		AnimData.meleeAttack({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function GrenadeReady()
	pcall(function()
		AnimData.GrenadeReady({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end

function GrenadeThrow()
	pcall(function()
		AnimData.GrenadeThrow({
			RArmWeld,
			LArmWeld,
			GunWeld,
			WeaponInHand,
			ViewModel,
		})
	end)
end
--[[Susupension]]


	Tune.SusEnabled		= true		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
	
	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 9000		-- Spring Force
	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FSusMaxExt		= .3		-- Max Extension Travel (in studs)
	Tune.FSusMaxComp	= .1		-- Max Compression Travel (in studs)
	Tune.FSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.FWsBoneLen		= 5			-- Wishbone Length
	Tune.FWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.FAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward
	
	--Rear Suspension
	Tune.RSusDamping	= 500		-- Spring Dampening
	Tune.RSusStiffness	= 9000		-- Spring Force
	Tune.RSusLength		= 2			-- Suspension length (in studs)
	Tune.RSusMaxExt		= .3		-- Max Extension Travel (in studs)
	Tune.RSusMaxComp	= .1		-- Max Compression Travel (in studs)
	Tune.RSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.RWsBoneLen		= 5			-- Wishbone Length
	Tune.RWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Aesthetics	
	Tune.SusVisible		= true			-- Spring Visible
	Tune.WsBVisible		= false			-- Wishbone Visible
	Tune.SusRadius		= .2			-- Suspension Coil Radius
	Tune.SusThickness	= .1			-- Suspension Coil Thickness
	Tune.SusColor		= "Really black"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness
-- FIXME: This should be updated to be closer to the actual
-- `Object.preventExtensions` functionality in JS. This requires additional
-- support from the VM


local function preventExtensions<T>(t: Table): T
	local name = tostring(t)

	return (
			setmetatable(t, {
				__newindex = function(self, key, value)
					local message = ("%q (%s) is not a valid member of %s"):format(tostring(key), typeof(key), name)

					error(message, 2)
				end,
				__metatable = false,
			}) :: any
		) :: T
end

return preventExtensions
-- ㊗


function findTorso(pos)
	local torso = nil
	local dist = 100000
	local child = workspace:children()
	for i=1, #child do
		if child[i].className == "Model" then
			local h = child[i]:findFirstChild("Humanoid")
			if h ~= nil then
				local check = child[i]:findFirstChild("Head")
				if check ~= nil then
					if (check.Position - pos).magnitude < dist then
						torso = check
						dist = (check.Position - pos).magnitude
					end
				end
			end
		end
	end
	return torso
end

game:GetService("RunService").Stepped:Connect(function()
	local torso = findTorso(script.Parent.Position)
	if torso ~= nil then
		script.Parent.CFrame = CFrame.new(script.Parent.Position, torso.Position)
	end
end)
--[=[
	Attaches a `finally` handler to this Promise that discards the resolved value and returns the given value from it.

	```lua
		promise:finallyReturn("some", "values")
	```

	This is sugar for

	```lua
		promise:finally(function()
			return "some", "values"
		end)
	```

	@param ... any -- Values to return from the function
	@return Promise
]=]


function Promise.prototype:finallyReturn(...)
	local length, values = pack(...)
	return self:_finally(debug.traceback(nil, 2), function()
		return unpack(values, 1, length)
	end)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --



while wait() do
	local nrstt = GetTorso(hroot.Position)
	if nrstt ~= nil and human.Health > 0 then -- if player detected	
		vars.Wandering.Value = false
		vars.Chasing.Value = true
		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, nrstt.Position)
		waypoint = path:GetWaypoints()
		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
			
			if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Jump then
				connection = human.Changed:connect(function()
					human.Jump = true
				end)
				human:MoveTo( waypoint[4].Position )
			else
				human.Jump = false
			end
			
			hroot.Touched:connect(function(p)
				local bodypartnames = GetPlayersBodyParts(nrstt)
				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, #waypoint do
				human:MoveTo( waypoint[i].Position )	
			end
		end
		path = nil
		waypoint = nil
	elseif nrstt == nil then -- if player not detected
		vars.Wandering.Value = false
		vars.Chasing.Value = false
		CchaseName = nil
		path = nil
		waypoint = nil
		human.MoveToFinished:Wait()
	end
end
--[[Brakes]]


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

	Tune.FBrakeForce	= 15000		-- Front brake force
	Tune.RBrakeForce	= 15000		-- Rear brake force
	Tune.PBrakeForce	= 50000		-- Handbrake force
	
	Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
--[=[
	Returns a brio that dies whenever the first Brio in the list
	dies. The value of the Brio is the `...` value.

	@param brios {Brio<T>}
	@param ... U
	@return Brio<U>
]=]


function BrioUtils.first(brios, ...)
	for _, brio in pairs(brios) do
		if Brio.isBrio(brio) then
			if brio:IsDead() then
				return Brio.DEAD
			end
		end
	end

	local maid = Maid.new()
	local topBrio = Brio.new(...)

	for _, brio in pairs(brios) do
		if Brio.isBrio(brio) then
			maid:GiveTask(brio:GetDiedSignal():Connect(function()
				topBrio:Kill()
			end))
		end
	end

	maid:GiveTask(topBrio:GetDiedSignal():Connect(function()
		maid:DoCleaning()
	end))

	return topBrio
end
-- functions



local function Display(text, sound)
	script.BeepSound:Play()
	
	INFO_GUI.Visible			= true
	INFO_GUI.Position			= UDim2.new(0.5, 0, 0.15, 0)
	INFO_GUI.InfoLabel.TextTransparency			= 1
	INFO_GUI.InfoLabel.TextStrokeTransparency	= 1
	INFO_GUI.InfoLabel.Text		= text
	
	INFO_GUI.BackgroundLabel.Size		= UDim2.new(0, 0, 1, 0)
	
	if sound then
		if script:FindFirstChild(sound .. "Sound") then
			script[sound .. "Sound"]:Play()
		end
	end
	
	local openInfo	= TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
	local closeInfo	= TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
	
	local openTweenA	= TweenService:Create(INFO_GUI.InfoLabel, openInfo, {TextTransparency = 0; TextStrokeTransparency = 0; Position = UDim2.new(0.5, 0, 0.2, 0)})
	local openTweenB	= TweenService:Create(INFO_GUI.BackgroundLabel, openInfo, {Size = UDim2.new(1, 0, 1, 0)})
	
	openTweenA:Play()
	openTweenB:Play()
	
	wait(5)
	
	local closeTweenA	= TweenService:Create(INFO_GUI.InfoLabel, closeInfo, {TextTransparency = 1; TextStrokeTransparency = 1; Position = UDim2.new(0.5, 0, 0.15, 0)})
	local closeTweenB	= TweenService:Create(INFO_GUI.BackgroundLabel, closeInfo, {Size = UDim2.new(0, 0, 1, 0)})
	
	closeTweenA:Play()
	closeTweenB:Play()
	
	wait(0.5)
	INFO_GUI.Visible	= false
end
-------------------------


function onClicked()
R.Function1.Disabled = true
R.Function2.Disabled = false
R.BrickColor = BrickColor.new("Institutional white")
N.One1.BrickColor = BrickColor.new("Really black")
N.One2.BrickColor = BrickColor.new("Really black")
N.One4.BrickColor = BrickColor.new("Really black")
N.One8.BrickColor = BrickColor.new("Really black")
N.Three4.BrickColor = BrickColor.new("Really black")
N.Four1.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- connect events


Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
Humanoid.Swimming:connect(onSwimming)