Pinkstack/roblox-luau-corpus-text huggingface dataset:
--//Main Function


ProximityPrompt.Triggered:Connect(function(Player)
	local Character = Player.Character
	local Torso = Character:WaitForChild("Left Arm")
	ProximityPrompt.ActionText = "Wear"
	if Character:FindFirstChild(script.Parent.Parent.Name) then
		Character[script.Parent.Parent.Name]:Destroy()
	else
		local NewArmor = Armor:Clone()
		NewArmor:SetPrimaryPartCFrame(Torso.CFrame)
		NewArmor.PrimaryPart:Destroy()
		ProximityPrompt.ActionText = "Take off"
		for _, part in pairs (NewArmor:GetChildren()) do
			if part:IsA("BasePart") then
				WeldParts(Torso, part)
				part.CanCollide = false
				part.Anchored = false
			end
		end
		NewArmor.Parent = Character
	end
end)
--[[Unsprung Weight]]

--
	Tune.FWheelDensity	= .1 		-- Front Wheel Density
	Tune.RWheelDensity	= .1 		-- Rear Wheel Density
	
	Tune.AxleSize		= 1 		-- Size of structural members (larger = more stable/carry more weight)
	Tune.AxleDensity	= .1 		-- Density of structural members
	Tune.AxlesVisible	= false 	-- Makes axle structural parts visible (Debug)
	
	Tune.HingeSize		= 1 		-- Size of steering hinges (larger = more stable/carry more weight)
	Tune.HingeDensity	= .1 		-- Density of steering hinges
	Tune.HingesVisible	= false 	-- Makes steering hinges visible (Debug)
-- Visualizes an impact. This will not run if FastCast.VisualizeCasts is false.


function DbgVisualizeHit(atCF: CFrame, wasPierce: boolean): SphereHandleAdornment?
	if FastCast.VisualizeCasts ~= true then return nil end
	local adornment = Instance.new("SphereHandleAdornment")
	adornment.Adornee = workspace.Terrain
	adornment.CFrame = atCF
	adornment.Radius = 0.4
	adornment.Transparency = 0.25
	adornment.Color3 = (wasPierce == false) and Color3.new(0.2, 1, 0.5) or Color3.new(1, 0.2, 0.2)
	adornment.Parent = GetFastCastVisualizationContainer()
	return adornment
end
--// SERVICES //--



local CoreGuiService = game:GetService('CoreGui')
local PlayersService = game:GetService('Players')
local GuiService = game:GetService('GuiService')
local UserInputService = game:GetService('UserInputService')
local StarterGui = game:GetService('StarterGui')
local STS_Settings = script.Parent:WaitForChild('STS_Settings')
local StaminaButton = script.Parent:WaitForChild('Mobile')
local Border = StaminaButton:WaitForChild('UIStroke')
local Bar = script.Parent:WaitForChild('Frame_Bar')
local SprintGui = script.Parent
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local plr = game.Players.LocalPlayer
local player = game.Players.LocalPlayer

local SprintingValue = STS_Settings.SprintingValue

local Character = game.Players.LocalPlayer.Character
if Character == nil then
	repeat
		wait()
	until (Character ~= nil)
	print('FoundCharacter')
end



local walking = script.IsWalking

local Breath = script.Breath

local BreathRunning = game:GetService("TweenService"):Create(Breath, TweenInfo.new(2), {Volume = 0.3})
Breath:Play()

local BreathRunningStop = game:GetService("TweenService"):Create(Breath, TweenInfo.new(2), {Volume = 0})

local Debounce = false
local Stamina = Character:WaitForChild('Stamina')
local Sprinting = false
local StaminaReductionRate = STS_Settings:WaitForChild('StaminaDeductionAmount').Value -- Amount taken from Stamina per SprintReductionDelay
local StaminaReductionDelay = STS_Settings:WaitForChild('StaminaDeductionDelay').Value -- Time in Seconds for SprintReductionRate to be removed from stamina
local OriginalWalkSpeed = Character.Humanoid.WalkSpeed -- Get Original WalkSpeed
local SprintSpeed = STS_Settings:WaitForChild('SprintSpeed').Value
local RegenerateDelay = STS_Settings:WaitForChild('StaminaRegenerationDelay').Value
local RegenerateValue = STS_Settings:WaitForChild('StaminaRegenerationAmount').Value
--// Setting things up


log("Setting things up")
for ind, loc in
	{
		_G = _G,
		game = game,
		spawn = spawn,
		script = script,
		getfenv = getfenv,
		setfenv = setfenv,
		workspace = workspace,
		getmetatable = getmetatable,
		setmetatable = setmetatable,
		loadstring = loadstring,
		coroutine = coroutine,
		rawequal = rawequal,
		typeof = typeof,
		print = print,
		math = math,
		warn = warn,
		error = error,
		assert = assert,
		pcall = pcall,
		xpcall = xpcall,
		select = select,
		rawset = rawset,
		rawget = rawget,
		ipairs = ipairs,
		pairs = pairs,
		next = next,
		Rect = Rect,
		Axes = Axes,
		os = os,
		time = time,
		Faces = Faces,
		delay = delay,
		unpack = unpack,
		string = string,
		Color3 = Color3,
		newproxy = newproxy,
		tostring = tostring,
		tonumber = tonumber,
		Instance = Instance,
		TweenInfo = TweenInfo,
		BrickColor = BrickColor,
		NumberRange = NumberRange,
		ColorSequence = ColorSequence,
		NumberSequence = NumberSequence,
		ColorSequenceKeypoint = ColorSequenceKeypoint,
		NumberSequenceKeypoint = NumberSequenceKeypoint,
		PhysicalProperties = PhysicalProperties,
		Region3int16 = Region3int16,
		Vector3int16 = Vector3int16,
		require = require,
		table = table,
		type = type,
		wait = wait,
		Enum = Enum,
		UDim = UDim,
		UDim2 = UDim2,
		Vector2 = Vector2,
		Vector3 = Vector3,
		Region3 = Region3,
		CFrame = CFrame,
		Ray = Ray,
		task = task,
		tick = tick,
		service = service,
	}
do
	locals[ind] = loc
end
--[[Vehicle Weight]]

	
	--Determine Current Mass
	local mass=0
	
	function getMass(p)
		for i,v in pairs(p:GetChildren())do
			if v:IsA("BasePart") then
				mass=mass+v:GetMass()
			end
			getMass(v)
		end	
	end
	getMass(car)
	
	--Apply Vehicle Weight
	if mass<_Tune.Weight*weightScaling then
		--Calculate Weight Distribution
		local centerF = Vector3.new()
		local centerR = Vector3.new()
		local countF = 0
		local countR = 0
		
		for i,v in pairs(Drive) do
			if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
				centerF = centerF+v.CFrame.p
				countF = countF+1
			else
				centerR = centerR+v.CFrame.p
				countR = countR+1
			end
		end
		centerF = centerF/countF
		centerR = centerR/countR
		local center = centerR:Lerp(centerF, _Tune.WeightDist/100)  
		
		--Create Weight Brick
		local weightB = Instance.new("Part",car.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 then
			weightB.Transparency = .75			
		else
			weightB.Transparency = 1			
		end
		weightB.Size = Vector3.new(_Tune.WeightBSize[1],_Tune.WeightBSize[2],_Tune.WeightBSize[3])
		weightB.CustomPhysicalProperties = PhysicalProperties.new(((_Tune.Weight*weightScaling)-mass)/(weightB.Size.x*weightB.Size.y*weightB.Size.z),0,0,0,0)
		weightB.CFrame=(car.DriveSeat.CFrame-car.DriveSeat.Position+center)*CFrame.new(0,_Tune.CGHeight,0)
	else
		--Existing Weight Is Too Massive
		warn( "\n\t [AC6C V".._BuildVersion.."]: 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)
			.."\n\t Reduce part size or axle density to achieve desired weight.")
	end
	
	local flipG = Instance.new("BodyGyro",car.DriveSeat)
	flipG.Name = "Flip"
	flipG.D = 0
	flipG.MaxTorque = Vector3.new(0,0,0)
	flipG.P = 0
----[[ Color Settings ]]


module.BackGroundColor = Color3.new(0, 0, 0)
module.DefaultMessageColor = Color3.new(1, 1, 1)
module.DefaultNameColor = Color3.new(1, 1, 1)
module.ChatBarBackGroundColor = Color3.new(0, 0, 0)
module.ChatBarBoxColor = Color3.new(1, 1, 1)
module.ChatBarTextColor = Color3.new(0, 0, 0)
module.ChannelsTabUnselectedColor = Color3.new(0, 0, 0)
module.ChannelsTabSelectedColor = Color3.new(30/255, 30/255, 30/255)
module.DefaultChannelNameColor = Color3.fromRGB(35, 76, 142)
module.WhisperChannelNameColor = Color3.fromRGB(102, 14, 102)
module.ErrorMessageTextColor = Color3.fromRGB(245, 50, 50)
-- place this script into StarterPlayerScripts
-- it will not work otherwise



local sm = Color3.fromRGB(0, 255, 255)--color of the message
local sm1 = Color3.fromRGB(255, 0, 0)--color of the message

game:GetService('Players').PlayerAdded:Connect(function(plr)
	
	
	local message = ("[Server]: "..plr.Name.." Just Joined The Game!")
		
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
		Text = message;
		Color = sm;
	})
end)
--For R15 avatars


Animations = {
	R15Slash = 522635514,
	R15Lunge = 522638767
}

Damage = DamageValues.BaseDamage

Grips = {
	Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
	Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
}

Sounds = {
	Slash = Handle:WaitForChild("SwordSlash"),
	Lunge = Handle:WaitForChild("SwordLunge"),
	Unsheath = Handle:WaitForChild("Unsheath")
}

ToolEquipped = false
--		print("Keyframe : ".. frameName)	


		playToolAnimation(toolAnimName, 0.0, Humanoid)
	end
end


function playToolAnimation(animName, transitionTime, humanoid)	 
		
		local roll = math.random(1, animTable[animName].totalWeight) 
		local origRoll = roll
		local idx = 1
		while roll > animTable[animName][idx].weight do
			roll = roll - animTable[animName][idx].weight
			idx = idx + 1
		end
-- light script



local clicks = 0

script.Parent.ClickDetector.MouseClick:Connect(function(clicked)
	if clicked then
		clicks = clicks + 1
		if clicks == 1 then
			script.Parent.Light.PointLight.Enabled = true
			elseif clicks == 2 then
			script.Parent.Light.PointLight.Enabled = false
			clicks = clicks - 2
		end
	end
end)
-- Leaderboard


function loadLeaderstats(player)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"

	local highScore = Instance.new("IntValue")
	highScore.Name = "High Score"
	highScore.Parent = stats
	highScore.Value = 0

	local currentScore = Instance.new("IntValue")
	currentScore.Name = "Score"
	currentScore.Parent = stats

	stats.Parent = player
end

function initialiseRunStats(player)
	if player:FindFirstChild("RunStats") then
		player.RunStats.Distance.Value = 0
		player.RunStats.CoinsCollected.Value = 0
	end
end

function showResults(player)
	local resultsGUI = game.ServerStorage.GUIs.PostRunGUI:Clone()
	resultsGUI.Frame.DistanceValue.Text = player.RunStats.Distance.Value
	resultsGUI.Frame.CoinsValue.Text = player.RunStats.CoinsCollected.Value
	resultsGUI.Frame.ScoreValue.Text = player.leaderstats.Score.Value

	resultsGUI.Parent = player.PlayerGui
	return resultsGUI
end

function initialiseNewRun(player, delayTime, charExpected, showLastResults)
	if not path then
		while not path do
			wait()
		end
	end

	local lastResultsGUI = nil
	if showLastResults then
		lastResultsGUI = showResults(player)
	end

	if delayTime ~= 0 then
		wait(delayTime)
	end

	if lastResultsGUI ~= nil then
		lastResultsGUI:Destroy()
	end

	if player and player.Parent then
		-- charExpected is needed to avoid calling LoadCharacter on players leaving the game
		if player.Character or charExpected == false then
			player:LoadCharacter()

			initialiseRunStats(player)

			local playersPath = path()
			lastActivePath[player.Name] = playersPath
			playersPath:init(player.Name)
		end
	end
end
--	====================
--	BULLET VISUALIZER
--	Enabled the gun to display a fake travelling bullet
--	====================



		VisualizerEnabled = true;
		BulletSpeed = 25;
		BulletSize = Vector3.new(0.25,0.25,100);
		BulletColor = BrickColor.new("Bright yellow");
		BulletTransparency = 0.25;
		BulletMaterial = Enum.Material.SmoothPlastic;
		FadeTime = 0.25; --Only work when bullet travel instantly. For this, you have to set BulletSpeed to "math.huge"
--[=[
	Converts an event into a Promise which resolves the next time the event fires.

	The optional `predicate` callback, if passed, will receive the event arguments and should return `true` or `false`, based on if this fired event should resolve the Promise or not. If `true`, the Promise resolves. If `false`, nothing happens and the predicate will be rerun the next time the event fires.

	The Promise will resolve with the event arguments.

	:::tip
	This function will work given any object with a `Connect` method. This includes all Roblox events.
	:::

	```lua
	-- Creates a Promise which only resolves when `somePart` is touched
	-- by a part named `"Something specific"`.
	return Promise.fromEvent(somePart.Touched, function(part)
		return part.Name == "Something specific"
	end)
	```

	@since 3.0.0
	@param event Event -- Any object with a `Connect` method. This includes all Roblox events.
	@param predicate? (...: P) -> boolean -- A function which determines if the Promise should resolve with the given value, or wait for the next event to check again.
	@return Promise<P>
]=]


function Promise.fromEvent(event, predicate)
	predicate = predicate or function()
		return true
	end

	return Promise._new(debug.traceback(nil, 2), function(resolve, _, onCancel)
		local connection
		local shouldDisconnect = false

		local function disconnect()
			connection:Disconnect()
			connection = nil
		end

		-- We use shouldDisconnect because if the callback given to Connect is called before
		-- Connect returns, connection will still be nil. This happens with events that queue up
		-- events when there's nothing connected, such as RemoteEvents

		connection = event:Connect(function(...)
			local callbackValue = predicate(...)

			if callbackValue == true then
				resolve(...)

				if connection then
					disconnect()
				else
					shouldDisconnect = true
				end
			elseif type(callbackValue) ~= "boolean" then
				error("Promise.fromEvent predicate should always return a boolean")
			end
		end)

		if shouldDisconnect and connection then
			return disconnect()
		end

		onCancel(disconnect)
	end)
end
--[=[
	@param player Player
	Clears the custom property value for the given player. When
	this occurs, the player will reset to use the top-level
	value held by this property (either the value set when the
	property was created, or the last value set by `Set`).

	```lua
	remoteProperty:Set("DATA")

	remoteProperty:SetFor(somePlayer, "CUSTOM_DATA")
	print(remoteProperty:GetFor(somePlayer)) --> "CUSTOM_DATA"

	-- DOES NOT CLEAR, JUST SETS CUSTOM DATA TO NIL:
	remoteProperty:SetFor(somePlayer, nil)
	print(remoteProperty:GetFor(somePlayer)) --> nil

	-- CLEAR:
	remoteProperty:ClearFor(somePlayer)
	print(remoteProperty:GetFor(somePlayer)) --> "DATA"
	```
]=]


function RemoteProperty:ClearFor(player: Player)
	if self._perPlayer[player] == nil then return end
	self._perPlayer[player] = nil
	self._rs:Fire(player, self._value)
end
-- Format params: methodName, ctorName


local ERR_NOT_INSTANCE = "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"

function SignalStatic.new(): Signal
	return setmetatable({
		Connections = {}
	}, SignalStatic)
end

local function NewConnection(sig: Signal, func: any): Connection 
	return setmetatable({
		Signal = sig,
		Delegate = func,
		Index = -1
	}, ConnectionStatic)
end

function SignalStatic:Connect(func)
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Connect", "Signal.new()"))
	local connection = NewConnection(self, func)
	connection.Index = #self.Connections + 1
	table.insert(self.Connections, connection.Index, connection)
	return connection
end

function SignalStatic:Fire(...)
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Fire", "Signal.new()"))
	local args = table.pack(...)
	local allCons = self.Connections
	for index = 1, #allCons do
		local connection = allCons[index]
		if connection.Delegate ~= nil then
			-- Catch case for disposed signals.
			coroutine.wrap(function ()
				connection.Delegate(table.unpack(args))
			end)()
		end
	end
end

function SignalStatic:FireSync(...)
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Fire", "Signal.new()"))
	local args = table.pack(...)
	local allCons = self.Connections
	for index = 1, #allCons do
		local connection = allCons[index]
		if connection.Delegate ~= nil then
			-- Catch case for disposed signals.
			connection.Delegate(table.unpack(args))
		end
	end
end

function SignalStatic:Dispose()
	assert(getmetatable(self) == SignalStatic, ERR_NOT_INSTANCE:format("Dispose", "Signal.new()"))
	local allCons = self.Connections
	for index = 1, #allCons do
		allCons[index]:Disconnect()
	end
	self.Connections = {}
	setmetatable(self, nil)
end

function ConnectionStatic:Disconnect()
	assert(getmetatable(self) == ConnectionStatic, ERR_NOT_INSTANCE:format("Disconnect", "private function NewConnection()"))
	table.remove(self.Signal.Connections, self.Index)
	self.SignalStatic = nil
	self.Delegate = nil
	self.Index = -1
	setmetatable(self, nil)
end

return SignalStatic
--- Creates an alias command


function Util.MakeAliasCommand(name, commandString)
	local commandName, commandDescription = unpack(name:split("|"))
	local args = {}

	commandString = Util.EncodeEscapedOperators(commandString)


	local seenArgs = {}

	for arg in commandString:gmatch("$(%d+)") do
		if seenArgs[arg] == nil then
			seenArgs[arg] = true
			local options = commandString:match("$" .. arg .. "(%b{})")

			local argType, argName, argDescription
			if options then
				options = options:sub(2, #options-1) -- remove braces
				argType, argName, argDescription = unpack(options:split("|"))
			end

			argType = argType or "string"
			argName = argName or ("Argument " .. arg)
			argDescription = argDescription or ""

			table.insert(args, {
				Type = argType;
				Name = argName;
				Description = argDescription;
			})
		end
	end

	return {
		Name = commandName,
		Aliases = {},
		Description = "<Alias> " .. (commandDescription or commandString),
		Group = "UserAlias",
		Args = args,
		Run = function(context)
			return Util.RunCommandString(context.Dispatcher, Util.SubstituteArgs(commandString, context.RawArguments))
		end
	}
end
-- Visualizes a ray. This will not run if FastCast.VisualizeCasts is false.


function DbgVisualizeSegment(castStartCFrame: CFrame, castLength: number): ConeHandleAdornment?
	if FastCast.VisualizeCasts ~= true then return nil end
	local adornment = Instance.new("ConeHandleAdornment")
	adornment.Adornee = workspace.Terrain
	adornment.CFrame = castStartCFrame
	adornment.Height = castLength
	adornment.Color3 = Color3.new()
	adornment.Radius = 0.25
	adornment.Transparency = 0.5
	adornment.Parent = GetFastCastVisualizationContainer()
	return adornment
end
--new magazine in, let's get to pushing that pull, kick thing back in its place...


	wait()
	weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(304), -0.14, math.rad(-82))

	wait()
	weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(302), -0.14, math.rad(-84))
	Tool.Handle.Reload.Pitch = 0.95
	wait()
	weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.14, math.rad(-86))

	wait()
	weld33.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-111), math.rad(-2),0.2)
	weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(298), -0.08, math.rad(-88))

	wait()
	weld33.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-108), math.rad(-4),0.1)
	weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(296), -0.02, math.rad(-90))

	wait()
	weld33.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-105), math.rad(-6),0)
	weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(294), 0.04, math.rad(-90))

	wait()
	weld33.C1 = CFrame.new(-0.75, 0.6, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-8),0)
	weld55.C1 = CFrame.new(-0.35, 0.3, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(292), 0.1, math.rad(-90))

	wait()
	weld33.C1 = CFrame.new(-0.75, 0.7, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-99), math.rad(-10),0)
	weld55.C1 = CFrame.new(-0.35, 0.3, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.16, math.rad(-90))

	wait()
	weld33.C1 = CFrame.new(-0.75, 0.8, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-96), math.rad(-12.5),0)
	weld55.C1 = CFrame.new(-0.35, 0.3, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))

	wait()
	weld33.C1 = CFrame.new(-0.75, 0.9, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-93), math.rad(-15),0)
	weld55.C1 = CFrame.new(-0.35, 0.3, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.28, math.rad(-90))
-- Teknikk Strobe Core V1 --


local Status = script.Parent.Parent.Status
local StrobeSync = script.Parent.Parent.StrobeSync
local Run = false
Status.Changed:connect(function()
	if Run then return end
	Run = true
	if Status.Value == 1 --ALARM&STROBE
	or Status.Value == 2 --STROBE
	or Status.Value == 11 --TEST
	then
		wait(1)
	while true do
		
		wait(1.5)
		StrobeSync.Value = true
		wait(0.1)
		StrobeSync.Value = false

	end
	
	end
end)
StrobeSync.Value = false
--[[ Roblox Services ]]

--
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local Workspace = game:GetService("Workspace")
local UserGameSettings = UserSettings():GetService("UserGameSettings")
local VRService = game:GetService("VRService")
--[[Steering]]


	Tune.SteerInner		= 36		-- Inner wheel steering angle (in degrees)
	Tune.SteerOuter		= 37		-- Outer wheel steering angle (in degrees)
	Tune.SteerSpeed		= .1		-- Steering increment per tick (in degrees)
	Tune.ReturnSpeed	= .1		-- Steering increment per tick (in degrees)
	Tune.SteerDecay		= 320		-- Speed of gradient cutoff (in SPS)
	Tune.MinSteer		= 10		-- Minimum steering at max steer decay (in percent)
	Tune.MSteerExp		= 1			-- Mouse steering exponential degree
	
	--Steer Gyro Tuning
	Tune.SteerD			= 1000		-- Steering Dampening
	Tune.SteerMaxTorque	= 50000		-- Steering Force
	Tune.SteerP			= 100000	-- Steering Aggressiveness
-- no touchy


local path
local waypoint
local oldpoints
local isWandering = 0

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

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