Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Module functions


function InterfaceModule.UpdateElectrons(balance)
	-- Change the text, that's really all there is to this
	local balance = balance or 0
	Interface.OpenMeta.Electrons.Text = FormatThousands(balance)
	--Interface.OpenMeta.Electrons.Text = ConvertToShortNum(balance)
end

function InterfaceModule.ToggleWindow(state)
	if ((not debounce) and (state ~= InterfaceModule.Open)) then
		debounce = true
		
		-- Tween the interface in or out
		Interface.MainMeta:TweenPosition(UDim2.new(0.5, 0, (state and 0.5) or 1.5, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 1)
		wait(1.1)
		
		-- Change the variables
		InterfaceModule.Open = state
		debounce = false
	end
end

function InterfaceModule.ToggleSpawnWindow(state)
	if ((not spawndebounce)) then
		spawndebounce = true
		
		-- Tween the interface in or out
		Interface.SpawnMeta:TweenPosition(UDim2.new(0.5, 0, (state and 0.5) or 1.5, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 1)
		wait(1.1)
		
		spawndebounce = false
	end
end

function InterfaceModule.ChangePage(page)
	if (Options:FindFirstChild(page)) then
		if ((not InterfaceModule.Changing) and (InterfaceModule.Page ~= page)) then
			InterfaceModule.Changing = true
			
			-- Set the UIPageLayout current page to the corresponding page for the button
			local index = Options:FindFirstChild(page)
			
			local previousButton = Options:FindFirstChild(InterfaceModule.Page)
			local newButton = Options:FindFirstChild(page)
	
			-- Change the colour for the previous button
			previousButton.Font = Enum.Font.Gotham
			previousButton.TextColor3 = Color3.fromRGB(227, 227, 227)
	
			-- Change the colour for the current button
			newButton.Font = Enum.Font.GothamBlack
			newButton.TextColor3 = Color3.new(1, 1, 1)
	
			-- Change the page
			Interface.MainMeta.Content.Content.UIPageLayout:JumpToIndex(index.LayoutOrder)
			
			-- Wait until the animation is finished
			wait(Interface.MainMeta.Content.Content.UIPageLayout.TweenTime + 0.1)
			
			-- Update the page variables
			InterfaceModule.Page = page
			InterfaceModule.Changing = false
		end
	end
end
-- create arrow


local p = Instance.new("Part")
p.formFactor = 2
p.Size = Vector3.new(1,.4,1)
p.Transparency = .5
p.BrickColor = BrickColor.new(21)
p.CanCollide = false
p.Locked = true
p.RotVelocity = Vector3.new(math.random(), math.random(), math.random()) * 10
local v = Vector3.new(script.Parent.Torso.CFrame.lookVector.x, 0, script.Parent.Torso.CFrame.lookVector.z)

p.CFrame = CFrame.new(script.Parent.Torso.CFrame.p + v * 8, v.unit)

local m = script.ArrowMesh:Clone() -- NASTY
m.Parent = p



local b = Instance.new("BodyPosition")
b.position = p.Position
b.Parent = p

local g = Instance.new("BodyGyro")
g.cframe = CFrame.new(Vector3.new(0,0,0), Vector3.new(0,0,1)) -- point North
g.maxTorque = Vector3.new(7e7, 7e7, 7e7)
g.Parent = p



p.Parent = game.Workspace







debris:AddItem(p, 10)


wait(5)

script.Parent = nil
--Rescripted by Luckymaxer


local an = nil
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")

ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")

ClientControl.OnClientInvoke = (function(Mode, Value)
	if Mode == "PlaySound" and Value then
		Value:Play()
	end
end)

function InvokeServer(Mode, Value, arg)
	pcall(function()
		ServerControl:InvokeServer(Mode, Value, arg)
	end)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	if not Player or not Humanoid or Humanoid.Health == 0 then
		return
	end
	an = Character.Humanoid:LoadAnimation(script.Parent.Hold)
	an:Play()
	Mouse.Button1Down:connect(function()
		InvokeServer("Click", true, Mouse.Hit.p)
	end)
end

local function Unequipped()
	an:Stop()
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
--// bolekinds



script.Parent.MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer.YouCash.Value >= 0 and workspace:FindFirstChild("Roommate").Head.Dialog.InUse == true then
		script.Parent.Parent.Parent.Ching:Play()
	else
		script.Parent.Parent.Parent.Thud:Play()
	end
end)
--[[
	Constructs and returns objects which can be used to model independent
	reactive state.
]]



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

local class = {}

local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
-- Public Functions


function WaypointPath:MoveTo()
	if self.currentIndex <= #self.waypoints then
		moveToAndWait(self.humanoid, self.waypoints[self.currentIndex].Position)
	else
		self._WaypointReachedEvent:Fire()
		return	
	end
	
	-- Next point
	self.currentIndex = self.currentIndex + 1
				
	-- Fire to listeners
	self._NodeReachedEvent:Fire()

	if self.count < 2 then
		-- Keep moving
		self.count = self.count + 1
		self:MoveTo()
	else
		self.count = 1
		self._FinishedMovingEvent:Fire()
	end
end

function WaypointPath:Stop()	
	self.humanoid:MoveTo(self.humanoidRoot.Position)
end


return WaypointPath
--- A helper that evaluates and runs the command in one go.
-- Either returns any validation errors as a string, or the output of the command as a string. Definitely a string, though.


function Dispatcher:EvaluateAndRun (text, executor, options)
	executor = executor or Players.LocalPlayer
	options = options or {}

	if RunService:IsClient() and options.IsHuman then
		self:PushHistory(text)
	end

	local command, errorText = self:Evaluate(text, executor, nil, options.Data)

	if not command then
		return errorText
	end

	local ok, out = pcall(function()
		local valid, errorText = command:Validate(true) -- luacheck: ignore

		if not valid then
			return errorText
		end

		return command:Run() or "Command executed."
	end)

	if not ok then
		warn(("Error occurred while evaluating command string %q\n%s"):format(text, out))
	end

	return ok and out or "An error occurred while running this command."
end
-- constants



return function(character)
	local effects	= character.Effects
	local emitters	= {}
	
	local emitter1	= script.BaseEmitter:Clone()
		emitter1.Parent	= character.Head
		
	local emitter2	= script.FlameEmitter:Clone()
		emitter2.Parent	= character.Head
		
	wait(5)
	
	emitter1.Enabled	= false
	emitter2.Enabled	= false
	
	Debris:AddItem(emitter1, 2)
	Debris:AddItem(emitter2, 1)
end
-- for fading images


function UITween.fadePart(object, amount, time, delay)

	local tweenAlpha = TweenInfo.new(
		time, --Time
		Enum.EasingStyle.Quad, --EasingStyle
		Enum.EasingDirection.Out, --EasingDirection
		0, --Repeat count
		false, --Reverses if true
		delay --Delay time
	)

	local tween = tweenService:Create(object, tweenAlpha, {Transparency = amount})
	tween:Play()
end

function UITween.fade(object, amount, time, delay)
	
	local tweenAlpha = TweenInfo.new(
		time, --Time
		Enum.EasingStyle.Quad, --EasingStyle
		Enum.EasingDirection.Out, --EasingDirection
		0, --Repeat count
		false, --Reverses if true
		delay --Delay time
	)
	
	local tween = tweenService:Create(object, tweenAlpha, {ImageTransparency = amount})
	tween:Play()
end
-- ROBLOX TODO START: implement when possible


function picomatch.matchBase(input, glob, options, posix_: boolean?): boolean
	error("matchBase not implemented")
	-- local _posix = posix_ or utils.isWindows(options)

	-- local regex = if instanceof(glob, RegExp) then glob else picomatch.makeRe(glob, options)
	-- -- ROBLOX FIXME: return regex:test(path:basename(input))
	-- return regex:test(input)
end
-- Local Functions


local function moveToAndWait(humanoid, targetPosition)
	local targetReached = false
	local runningThread = coroutine.running()
	local connection1 = humanoid.MoveToFinished:Connect(function(reachedTarget)
		if reachedTarget then
			targetReached = true
			coroutine.resume(runningThread)
		end
	end)
	local connection2 = humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
		humanoid:MoveTo(targetPosition)
	end)
	humanoid:MoveTo(targetPosition)
	coroutine.wrap(function()
		while not targetReached do
			wait(6)
			if not humanoid.Parent or humanoid.WalkToPoint ~= targetPosition then
				break
			end
			humanoid:MoveTo(targetPosition)
		end    
	end)()
	coroutine.yield()
	connection1:Disconnect()
	connection2:Disconnect()
end
-- Server:



function network:newEvent(name,callback)
	new("RemoteEvent",name).OnServerEvent:Connect(callback or blank);
end

function network:newFunction(name,callback)
	new("RemoteFunction",name).OnServerInvoke = callback or blank;
end

function network:fireClients(name,clients,...)
	local event = get(name);
	if(clients == "all") then
		event:FireAllClients(...);
	else
		for _,client in pairs(clients) do
			event:FireClient(client,...);
		end
	end
end
--[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]

--
local PlayerSpawning=false; --[[ Change this to true if you want the NPC to spawn like a player, and change this to false if you want the NPC to spawn at it's current position. ]]--
local AdvancedRespawnScript=script;
repeat Wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
local Ben=AdvancedRespawnScript.Parent;
if AdvancedRespawnScript and Ben and Ben:FindFirstChild("Thumbnail")then
Ben:FindFirstChild("Thumbnail"):Destroy();
end;
local GameDerbis=Game:GetService("Debris");
local BenHumanoid;
for _,Child in pairs(Ben:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then BenHumanoid=Child;
end;
end;
local Respawndant=Ben:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
--// Bullet Physics


	BulletPhysics = Vector3.new(0,60,0); -- Drop fixation: Lower number = more drop
	BulletSpeed = 800; -- Bullet Speed
	BulletSpread = 0; -- How much spread the bullet has
	
	ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
	ExploSpeed = 600; -- Speed for explosive rounds
	
	BulletDecay = 100000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
--<< Gun Settings >>--



ToolName="M4A1"				-- The name of the tool, needed to be put for the script

ClipSize= 30				-- The amount of bullets that the player gets each time
ReloadTime= 3				-- How much time it takes to reload the gun in bullets (in seconds)
Firerate= .12				-- The rate of the gun
BaseDamage= 20				-- The damage that the gun does

automatic= true				-- Set true if the gun is an automatic type (miniguns, machine guns, etc)
burst= false				-- Set true if the gun is a burst type (shotguns, im too lasy :p )
shot= false					-- Set true if the gun is a shot type (snipers, pistols, etc)

MinSpread= .06
MaxSpread= .8
SpreadRate= .9

BarrlePos=Vector3.new(0,0,0)
Cursors={"rbxasset://textures\\GunCursor.png"}				-- The mouse cursor when the player equips the gun
ReloadCursor="rbxasset://textures\\GunWaitCursor.png"		-- The cursor when the player is reloading the gun
--print(FRP-FLP)



	F = carSeat.AirPhysics 
	
	lv = carSeat.CFrame.lookVector
	uv = carSeat.CFrame.upVector
	rv = carSeat.CFrame.rightVector
	
	if carSeat.Velocity.Y > 0 then
		vy = carSeat.Velocity.Y*50
	else
		if carSeat.Velocity.Y*-70 > 7000 then
		vy = 7000
		else
		vy = carSeat.Velocity.Y*-70
		end
	end
	
	vx = carSeat.Velocity.X*-.5
	vz = carSeat.Velocity.Z*-.5
	
	F.Force = Vector3.new(vx, vy*1.4, vz)
	--print(F.Force)
avw = (carSeat.Parent.Parent.Wheels.FL.Wheel.Position.Y + carSeat.Parent.Parent.Wheels.FR.Wheel.Position.Y + carSeat.Parent.Parent.Wheels.RL.Wheel.Position.Y + carSeat.Parent.Parent.Wheels.RR.Wheel.Position.Y)/4
 if carSeat.Parent.Parent.RW.Pad.Position.Y < carSeat.Parent.Parent.RW.UPad.Position.Y then flpp = true
	count = count + 0.1
else
	count = 0 flpp = false
end

if speed < 3 then
	vlam = 3
else
	vlam = 17
end
if script.Parent.Storage.Autoflip.Value == true then
	if count > vlam then 
	carSeat.Flip.MaxTorque = Vector3.new(400000, 0, 400000) wait(0.5)
	else 
		carSeat.Flip.MaxTorque = Vector3.new(0, 0, 0)
	end
	else carSeat.Flip.MaxTorque = Vector3.new(0, 0, 0)
end
if avw + 2 < script.av.Value or avw - 2 > script.av.Value then
------------------------------------------------------------------------------------------------------------------------------
--// Static functions



local function getAlignMultiplier(enum)
	return (justify1[enum.Name] and 1) or (justify0[enum.Name] and 0) or 0.5;
end;

local function getClosestNumber(n, set)
	sort(set, function(a, b) return abs(n - a) < abs(n - b); end);
	return set[1];
end;
--// Declarables


local CannonReload = false

local RotLeftKeyDown = false
local RotRightKeyDown = false

local IncreaseAltKeyDown = false
local DecreaseAltKeyDown = false

local Degrees = 0
local Degrees2 = 0
	local MaxDown = -5
	local MaxUp = 16

local ShellType
	ShellType = Settings.DefaultShell

local Aiming = false


if Settings.AimReticle ~= 0 then
	System.Gun.Retical.Decal.Texture = ("rbxassetid://"..Settings.AimReticle)
end
-- Bind drawer opening function to remote event


lamp.BoundingBox.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
	if player.Character and player.Character:FindFirstChild("Torso") then
		local torso = player.Character:FindFirstChild("Torso")
		local toTorso = torso.Position - lamp.BoundingBox.Position
		if toTorso.magnitude < clickDistance then
			lamp.Light.PointLight.Enabled = not lamp.Light.PointLight.Enabled
		end
	end
end)
-------------------------------------------------------------------


A = script.Parent.Parent.Parent.Parent.Parent.Parent.Character
Option = script.Parent
on=false
function EyeGlow()
	if on==false then
		A.Tors.Waist.Torso.Breath:Play()
		on=true
	elseif on==true then
		A.Tors.Waist.Torso.Breath:Stop()
		on=false
	end
end
script.Parent.MouseButton1Click:connect(EyeGlow)
-- separated enabling/disabling spawn points into a simple script to make sure it runs w/o yielding before players join



local ReplicatedStorage = game:GetService("ReplicatedStorage")

local globalSettings = require(ReplicatedStorage.DemoGlobalSettings)

if( game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0 ) then
	workspace.SpawnLocationLobby.Enabled = false
	workspace.SpawnLocation.Enabled = true
else
	--workspace.TempStorage.Test.SpawnLocationTEST.Enabled = true
	workspace.SpawnLocationLobby.Enabled = globalSettings.forceSpawnInTheLobby
	workspace.SpawnLocationHouse.Enabled = false -- change this to globalSettings.forceSpawnInTheLobby and the line below to false to spawn near the house
	workspace.SpawnLocation.Enabled = not globalSettings.forceSpawnInTheLobby
end
--Variables


local SeatInteractionCount = {}

local VehicleSeating = {}

local function getEffectsFolderFromSeat(seat)
	local parent = seat.Parent
	if parent:IsA("Model") then
		if parent:FindFirstChild("Effects") then
			return parent.Effects
		else
			return getEffectsFolderFromSeat(parent)
		end
	end
	return nil
end

local function playDoorSound(seat, sound)
	local sound = seat:FindFirstChild(sound.."Door")
	if sound then
		sound:Play()
	end
end
--[[**
	ensure value is an Instance and it's ClassName matches the given ClassName

	@param className The class name to check for

	@returns A function that will return true iff the condition is passed
**--]]


function t.instanceOf(className, childTable)
	assert(t.string(className))

	local childrenCheck
	if childTable ~= nil then
		childrenCheck = t.children(childTable)
	end

	return function(value)
		local instanceSuccess, instanceErrMsg = t.Instance(value)
		if not instanceSuccess then
			return false, instanceErrMsg or ""
		end

		if value.ClassName ~= className then
			return false, string.format("%s expected, got %s", className, value.ClassName)
		end

		if childrenCheck then
			local childrenSuccess, childrenErrMsg = childrenCheck(value)
			if not childrenSuccess then
				return false, childrenErrMsg
			end
		end

		return true
	end
end
t.instance = t.instanceOf
--[[
	Returns true if the object is protected by a forcefield
--]]



return function(obj)
	local protected = false
	local check = obj
	while true do
		local hasFF = false
		for index, child in next, check:GetChildren() do
			if child:IsA'ForceField' then
				hasFF = true
				break
			end
		end
		if hasFF then
			protected = true
			break
		else
			check = check.Parent
			if check == nil or check == game or check.Parent == game then
				break
			end
		end
	end
	
	return protected
end
--Stickmasterluke




sp=script.Parent


powertime=3

equipped=false
powered=false


while sp:FindFirstChild("ElectricWeld")==nil do 
	wait()
end
local storeweld=sp.ElectricWeld
local initCF = storeweld.C0

sp.Handle.Touched:connect(function(hit)
	if hit~=nil and powered then
		local eh=hit.Parent:FindFirstChild("Humanoid")
		local h=sp.Parent:FindFirstChild("Humanoid")
		if h~=nil and eh~=nil and h~=eh then
			if h.Health>0 and eh.Health>0 and h.Parent:FindFirstChild("GetTasedBro")==nil then
				--[[powered=false
				sp.Enabled=false]]
				local ts=script.GetTasedBro:clone()
				ts.Parent=hit.Parent
				ts.Disabled=false
			end
		end
	end
end)

sp.Activated:connect(function()
	local chr=sp.Parent
	local h=chr:FindFirstChild("Humanoid")
	if h~=nil then
		if h.Health>0 and not powered then
			sp.Enabled=false
			powered=true
			local s=sp.Handle:FindFirstChild("Sound")
			if s~=nil then
				s:Play()
			end
			delay(0,function()
				local ii=0
				while powered do
					ii=ii+1					
					if storeweld and ii%2==0 then
						storeweld.C0 = initCF * CFrame.Angles(0, 0, math.random()/3.0) --* CFrame.Angles(0, 1.3, 0)
					end
					local pain=sp:FindFirstChild("Pain")
					if pain~=nil then
						pain.Transparency=ii%2
					end
					wait(.1)
				end
				storeweld.C0 = initCF
				local s=sp.Handle:FindFirstChild("Sound")
				if s~=nil then
					s:Stop()
				end
				local pain=sp:FindFirstChild("Pain")
				if pain~=nil then
					pain.Transparency=1
				end
			end)
			wait(powertime)
			sp.Enabled=true
			powered=false
		end
	end
end)

sp.Equipped:connect(function()
	equipped=true
	powered=false
	local pain=sp:FindFirstChild("Pain")
	if pain~=nil then
		pain.Transparency=1
	end
	if storeweld then
		storeweld.Parent=sp
	end 
end)
sp.Unequipped:connect(function()
	powered=false
	equipped=false
end)
-- for fading text


function UITween.fadeText(object, amount, time, delay)

	local tweenAlpha = TweenInfo.new(
		time, --Time
		Enum.EasingStyle.Quad, --EasingStyle
		Enum.EasingDirection.Out, --EasingDirection
		0, --Repeat count
		false, --Reverses if true
		delay --Delay time
	)

	local tween1 = tweenService:Create(object, tweenAlpha, {TextTransparency = amount})
	tween1:Play()

end
----------------------------------------------------------------------------------------------------
-----------------=[ General ]=----------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	 TeamKill = false					--- Enable TeamKill?
	,TeamDamageMultiplier = 1			--- Between 0-1 | This will make you cause less damage if you hit your teammate
	
	,ReplicatedBullets = true			--- Keep in mind that some bullets will pass through surfaces...
	
	,AntiBunnyHop = true				--- Enable anti bunny hop system?
	,JumpCoolDown = 0.5					--- Seconds before you can jump again
	,JumpPower = 55						--- Jump power, default is 50
	
	,RealisticLaser = true				--- True = Laser line is invisible
	,ReplicatedLaser = true				
	,ReplicatedFlashlight = true
	
	,EnableRagdoll = true				--- Enable ragdoll death?
	,TeamTags = false					--- Aaaaaaa
	,HitmarkerSound = true				--- GGWP MLG 360 NO SCOPE xD
-- Bezier.new(x1, y1, x2, y2)
-- @param numbers (x1, y1, x2, y2) The control points of your curve
-- @returns function(t [b, c, d])
--	@param number t the time elapsed [0, d]
--	@param number b beginning value being interpolated (default = 0)
--	@param number c change in value being interpolated (equivalent to: ending - beginning) (default = 1)
--	@param number d duration interpolation is occurring over (default = 1)
--Constructor and destructor


function draw_invincibility:New(holder)
	--Initialize meta reference
	local self = setmetatable({}, {__index = draw_invincibility})

	--Create model instance
	self.holder = holder

	self.invincibility = models:WaitForChild("Invincibility"):clone()
	self.particles = self.invincibility:WaitForChild("RootPart"):WaitForChild("Invincibility"):GetChildren()
	self.invincibility.Parent = self.holder

	--Initialize state
	self.enabled = false
	self.hrp_cf = nil
	self.en_time = 0
	self.part_time = 0
	for _,v in pairs(self.particles) do
		self.part_time = math.max(self.part_time, v.Lifetime.Max)
	end

	return self
end

function draw_invincibility:Destroy()
	--Destroy model instance
	self.invincibility:Destroy()
end
--	local AttackRange, FieldOfView, AggroRange, ChanceOfBoredom, BoredomDuration, 
--		Damage, DamageCooldown



	local configTable = model.Configurations
	local configs = {}
	local function loadConfig(configName, defaultValue)
		if configTable:FindFirstChild(configName) then
			configs[configName] = configTable:FindFirstChild(configName).Value
		else
			configs[configName] = defaultValue
		end
	end

	loadConfig("AttackRange", 3)
	loadConfig("FieldOfView", 180)
	loadConfig("AggroRange", 200)
	loadConfig("ChanceOfBoredom", .5)
	loadConfig("BoredomDuration", 10)
	loadConfig("Damage", 10)
	loadConfig("DamageCooldown", 1)
	
	local StateMachine = require(game.ServerStorage.ROBLOX_StateMachine).new()
	local PathLib = require(game.ServerStorage.ROBLOX_PathfindingLibrary).new()
	local ZombieTarget = nil	
	local ZombieTargetLastLocation = nil
	
	local lastBored = os.time()	
	
	-- STATE DEFINITIONS	
	
	-- IdleState: NPC stays still. Refreshes bored timer when started to
	-- allow for random state change
	local IdleState = StateMachine.NewState()
	IdleState.Name = "Idle"
	IdleState.Action = function()
	end
	IdleState.Init = function()
		lastBored = os.time()
	end	
	
	-- SearchState: NPC wanders randomly increasing chance of spotting
	-- enemy. Refreshed bored timer when started to allow for random state
	-- change
	local SearchState = StateMachine.NewState()
	SearchState.Name = "Search"
	local lastmoved = os.time()
	local searchTarget = nil
	SearchState.Action = function()
		-- move to random spot nearby
		if model then
			local now = os.time()
			if now - lastmoved > 2 then
				lastmoved = now
				local xoff = math.random(5, 10)
				if math.random() > .5 then
					xoff = xoff * -1
				end
				local zoff = math.random(5, 10)
				if math.random() > .5 then
					zoff = zoff * -1
				end
				
				local testtarg = AIUtilities:FindCloseEmptySpace(model)
				--if testtarg then print(testtarg) else print("could not find") end
				searchTarget = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
				--local target = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
				--model.Humanoid:MoveTo(target)
				searchTarget = testtarg
			end
			if searchTarget then
				PathLib:MoveToTarget(model, searchTarget)
			end
		end
	end
	SearchState.Init = function()
		lastBored = os.time()
	end
	
	-- PursueState: Enemy has been spotted, need to give chase.
	local PursueState = StateMachine.NewState()
	PursueState.Name = "Pursue"
	PursueState.Action = function()
		-- Double check we still have target
		if ZombieTarget then
			-- Get distance to target
			local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
			-- If we're far from target use pathfinding to move. Otherwise just MoveTo
			if distance > configs["AttackRange"] + 5 then
				PathLib:MoveToTarget(model, ZombieTarget.HumanoidRootPart.Position)
			else
				model.Humanoid:MoveTo(ZombieTarget.HumanoidRootPart.Position)