Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[*
 * Posix glob regex
 ]]


local DOT_LITERAL = "\\."
local PLUS_LITERAL = "\\+"
local QMARK_LITERAL = "\\?"
local SLASH_LITERAL = "\\/"
local ONE_CHAR = "(?=.)"
local QMARK = "[^/]"
local END_ANCHOR = ("(?:%s|$)"):format(SLASH_LITERAL)
local START_ANCHOR = ("(?:^|%s)"):format(SLASH_LITERAL)
local DOTS_SLASH = ("%s{1,2}%s"):format(DOT_LITERAL, END_ANCHOR)
local NO_DOT = ("(?!%s)"):format(DOT_LITERAL)
local NO_DOTS = ("(?!%s%s)"):format(START_ANCHOR, DOTS_SLASH)
local NO_DOT_SLASH = ("(?!%s{0,1}%s)"):format(DOT_LITERAL, END_ANCHOR)
local NO_DOTS_SLASH = ("(?!%s)"):format(DOTS_SLASH)
local QMARK_NO_DOT = ("[^.%s]"):format(SLASH_LITERAL)
local STAR = ("%s*?"):format(QMARK)
local POSIX_CHARS = {
	DOT_LITERAL = DOT_LITERAL,
	PLUS_LITERAL = PLUS_LITERAL,
	QMARK_LITERAL = QMARK_LITERAL,
	SLASH_LITERAL = SLASH_LITERAL,
	ONE_CHAR = ONE_CHAR,
	QMARK = QMARK,
	END_ANCHOR = END_ANCHOR,
	DOTS_SLASH = DOTS_SLASH,
	NO_DOT = NO_DOT,
	NO_DOTS = NO_DOTS,
	NO_DOT_SLASH = NO_DOT_SLASH,
	NO_DOTS_SLASH = NO_DOTS_SLASH,
	QMARK_NO_DOT = QMARK_NO_DOT,
	STAR = STAR,
	START_ANCHOR = START_ANCHOR,
}
--[[

MIT License

]]



local Player = game.Players.LocalPlayer
local Mouse  = Player:GetMouse()
local Tool   = script.Parent
local Using  = false
local RemoteEvent = game.ReplicatedStorage.Events.Etc.Detain

Tool.Activated:Connect(function()
	if not Using then
		if Mouse.Target then
			if (Mouse.Target.Position-Player.Character.HumanoidRootPart.Position).Magnitude < 10 then 
			RemoteEvent:FireServer('Cuff', Mouse.Target)
			end
		end
	else 
		Using = false
		RemoteEvent:FireServer('UnCuff')
	end
end)
Tool.Unequipped:Connect(function()
if Using == true then
RemoteEvent:FireServer('UnCuff')
end
Using = false

end)
RemoteEvent.OnClientEvent:Connect(function( state )
wait(.5)
	if state == 'Use' then
		Using = true
	end
end)
-- Get references to the DockShelf and the AppManager frame


local dockShelf = script.Parent.Parent.MobileDock
local wallShelf = script.Parent.Parent.Wallpaper.Apps
local appManager = script.Parent.Parent.AppManager
local ClipSettings = require(game.ReplicatedFirst.ClipSettings)
local UISpeed = ClipSettings.uiSpeed
local TweenService = game:GetService("TweenService")
-- ROBLOX deviation: this regex attempts to match both ansi16 and ansi256 regexes


local ansiRegex = string.char(27) .. "%[%d+;?5?;?%d*m"

local ansiLookupTable = {
	[chalk.red.close] = "</>",
	[chalk.green.close] = "</>",
	[chalk.cyan.close] = "</>",
	[chalk.gray.close] = "</>",
	[chalk.white.close] = "</>",
	[chalk.yellow.close] = "</>",
	[chalk.bgRed.close] = "</>",
	[chalk.bgGreen.close] = "</>",
	[chalk.bgYellow.close] = "</>",
	[chalk.inverse.close] = "</>",
	[chalk.dim.close] = "</>",
	[chalk.bold.close] = "</>",
	[chalk.reset.open] = "</>",
	[chalk.reset.close] = "</>",
	[chalk.red.open] = "<red>",
	[chalk.green.open] = "<green>",
	[chalk.cyan.open] = "<cyan>",
	[chalk.gray.open] = "<gray>",
	[chalk.white.open] = "<white>",
	[chalk.yellow.open] = "<yellow>",
	[chalk.bgRed.open] = "<bgRed>",
	[chalk.bgGreen.open] = "<bgGreen>",
	[chalk.bgYellow.open] = "<bgYellow>",
	[chalk.inverse.open] = "<inverse>",
	[chalk.dim.open] = "<dim>",
	[chalk.bold.open] = "<bold>",
}

local function toHumanReadableAnsi(text: string)
	return text:gsub(ansiRegex, function(match)
		if ansiLookupTable[match] then
			return ansiLookupTable[match]
		else
			return ""
		end
	end)
end

local function test(val: any)
	return typeof(val) == "string" and Boolean.toJSBoolean(val:match(ansiRegex))
end

local function serialize(val: string, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer)
	return printer(toHumanReadableAnsi(val), config, indentation, depth, refs)
end

return {
	test = test,
	serialize = serialize,
	-- ROBLOX deviation: exporting ansiRegex since we don't have a separate module for it
	ansiRegex = ansiRegex,
	-- ROBLOX deviation: exporting toHumanReadableAnsi
	toHumanReadableAnsi = toHumanReadableAnsi,
}
--Differential Settings	


Tune.FDiffSlipThres	= 90		-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres	= 60		-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres	= 90		-- 1 - 100%
Tune.RDiffLockThres	= 60		-- 0 - 100%
Tune.CDiffSlipThres	= 50		-- 1 - 100%				[AWD Only]
Tune.CDiffLockThres	= 50		-- 0 - 100%				[AWD Only]
--Brake.InputChanged:Connect(TouchBrake)



local function TouchHandbrake(input, GPE)
	if input.UserInputState == Enum.UserInputState.Begin then
		_PBrake = not _PBrake
	elseif input.UserInputState == Enum.UserInputState.End then
		if bike.DriveSeat.Velocity.Magnitude>5 then
			_PBrake = false
		end
	end
end
Handbrake.InputBegan:Connect(TouchHandbrake)
Handbrake.InputEnded:Connect(TouchHandbrake)
--When strafing make sure you can see target from end pos


function movement.strafe()
	local goalPos = status:get("currentTarget").Position
	local origin,dir = myRoot.Position,nil
	
	local action = math.random(2)
	if action == 1 then
		dir = myRoot.CFrame.RightVector
	elseif action == 2 then
		dir = -myRoot.CFrame.RightVector
	end
	
	for _=1,10 do
		if not core.raycast(origin,dir*2) and core.raycast(origin,Vector3.new(0,-7,0)) then
			origin += dir*2
		else
			origin += dir*-2
			break
		end
	end
	
	local _,result = core.raycast(origin,(status:get("currentTarget").Position - origin).Unit * 30)
	if result then
		if result.Instance:IsDescendantOf(status:get("currentTarget").Parent) then

		else

			origin = myRoot.Position
		end
		origin = myRoot.Position
	end
	
	return origin
end

function checkDirection(dir)
	local goalPos = status:get("currentTarget").Position
	local origin = myRoot.Position
	
	local success = false
	for i=1, 5 do
		if not core.raycast(origin,dir*1) and core.raycast(origin,Vector3.new(0,-7,0)) then
			origin = origin + dir*1
		else
			origin = origin + dir*-1
			break
		end
		
		if i == 5 then
			success = true
		end
	end
	
	return success,origin
end

function movement.retreat()
	
	--Check if we can retreat directly from the enemy.
	local result,pos = checkDirection(-(status:get("currentTarget").Position - myRoot.Position).Unit)
	if result then
		return pos
	end
	
	--Check if we can move away to the right.
	result,pos = checkDirection(myRoot.CFrame.RightVector)
	if result then
		return pos
	end
	
	--Check if can move away to the left.
	result,pos = checkDirection(-myRoot.CFrame.RightVector)
	if result then
		return pos
	end
	
	return myRoot.Position
end

function movement.slowAdvance()
	local goalPos = status:get("currentTarget").Position
	local origin = myRoot.Position
	
	local maxIterations = 30
	repeat
		maxIterations -= 1
		if not core.raycast(origin,(goalPos - origin).Unit*1) and core.raycast(origin,Vector3.new(0,-7,0)) then
			origin = origin + (goalPos - origin).Unit*1
		else
			origin = origin + (goalPos - origin).Unit*-1
			break
		end
		if maxIterations <= 0 then
			break
		end
	until false 
	
	return origin
end
-- for the final is recommended to divide the size of the rear sprocket to the one of the front sprocket
-- and multiply it to the primary drive ratio, if data is missing, you can also just use a single number


Tune.NeutralRev		= true			-- Enables you to back up manually in neutral
Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
	--[[Neutral]]	0			,	-- Ratios can also be deleted
	--[[ 1 ]]		3.827		,	
	--[[ 2 ]]		2.36		,
	--[[ 3 ]]		1.685		,
	--[[ 4 ]]		1.313		,
	--[[ 5 ]]		1			,
	--[[ 6 ]]		.793		,
}

Tune.FDMult			= 1

Tune.Limiter 		= false 		-- Enables a speed limiter
Tune.SpeedLimit 	= 300 			-- At what speed (SPS) the limiter engages
-- run



local normal = cutPlane.CFrame.rightVector; 
if choppingBlock then
	pos1, size1, pos2, size2 = slicePart(choppingBlock, cutPlane.Position, normal);
	--choppingBlock.Anchored = false;
end

if (pos1 and size1 and pos2 and size2) then
	local part = choppingBlock:Clone();
	part.Size = size1;
	part.CFrame = CFrame.new(pos1);
	part.Parent = choppingBlock.Parent;
	part.Anchored = true
	part.Name = "1"

	local part = choppingBlock:Clone();
	part.Size = size2;
	part.CFrame = CFrame.new(pos2);
	part.Parent = choppingBlock.Parent;
	part.Anchored = true
	part.Name = "2"
	
	choppingBlock:Destroy();
	if script:GetAttribute("Direction") == "Left" then
		workspace["1"].Parent = workspace.Stacked
		workspace["2"].Anchored = false
		workspace["2"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	elseif script:GetAttribute("Direction") == "Right" then
		workspace["2"].Parent = workspace.Stacked
		workspace["1"].Anchored = false
		workspace["1"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	elseif script:GetAttribute("Direction") == "Top" then
		workspace["1"].Parent = workspace.Stacked
		workspace["2"].Anchored = false
		workspace["2"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	elseif script:GetAttribute("Direction") == "Bottom" then
		workspace["2"].Parent = workspace.Stacked
		workspace["1"].Anchored = false
		workspace["1"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	end
end
--[[ @brief Reshuffles the heap if a given index is larger than one of its children.
--]]


function Heap:_HeapifyTopDown(i)
	local l = i * 2;
	local r = l + 1;
	local largest;
	if l <= #self and self.Comparator(self[l], self[i]) then
		largest = l;
	else
		largest = i;
	end
	if r <= #self and self.Comparator(self[r], self[largest]) then
		largest = r;
	end
	if largest ~= i then
		self[i], self[largest] = self[largest], self[i];
		self:_HeapifyTopDown(largest);
	end
end
--------------------------------------------------------------------------



local _WHEELTUNE = {
																		--[[	
			SS6 Presets
	[Eco]		
		WearSpeed = 1,
		TargetFriction = .7,
		MinFriction = .1,
	[Road]		
		WearSpeed = 2,
		TargetFriction = .7,
		MinFriction = .1,
	[Sport]		
		WearSpeed = 3,
		TargetFriction = .79,
		MinFriction = .1,											]]

	TireWearOn 		= true	,
	
	--Friction and Wear
	FWearSpeed		=  3 	,
	FTargetFriction	= .5	,
	FMinFriction 	= .1	,
	
	RWearSpeed		=  3 	,
	RTargetFriction	= .5	,
	RMinFriction	= .1	,
	
	--Tire Slip
	TCSOffRatio		= 1/3	,
	WheelLockRatio	= 1/2	,	--SS6 Default = 1/4
	WheelspinRatio	= 1/1.1	,	--SS6 Default = 1/1.2
	
	--Wheel Properties
	FFrictionWeight	= 1		,	--SS6 Default = 1
	RFrictionWeight	= 1		,	--SS6 Default = 1
	FLgcyFrWeight	= 10	,
	RLgcyFrWeight	= 10	,
	
	FElasticity		= .5		,	--SS6 Default = .5
	RElasticity		= .5		,	--SS6 Default = .5
	FLgcyElasticity	= 0		,
	RLgcyElasticity	= 0		,
	
	FElastWeight	= 1		,	--SS6 Default = 1
	RElastWeight	= 1		,	--SS6 Default = 1
	FLgcyElWeight	= 10	,
	RLgcyElWeight	= 10	,
	
	--Wear Regen
	RegenSpeed		= 3.6		--SS6 Default = 3.6
}
--[[ By: Brutez. Script Fixed By Xcorrectgamermaster ]]

--
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 JeffTheKiller=AdvancedRespawnScript.Parent;
local GameDerbis=game:GetService("Debris");
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local Respawndant=JeffTheKiller:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
if JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid:FindFirstChild("Status")and not JeffTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
SpawnModel=Instance.new("Model");
SpawnModel.Parent=JeffTheKillerHumanoid.Status;
SpawnModel.Name="AvalibleSpawns";
else
SpawnModel=JeffTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
end;
function FindSpawn(SearchValue)
local PartsArchivable=SearchValue:GetChildren();
for AreaSearch=1,#PartsArchivable do
if PartsArchivable[AreaSearch].className=="SpawnLocation"then
local PositionValue=Instance.new("Vector3Value",SpawnModel);
PositionValue.Value=PartsArchivable[AreaSearch].Position;
PositionValue.Name=PartsArchivable[AreaSearch].Duration;
end;
FindSpawn(PartsArchivable[AreaSearch]);
end;
end;
FindSpawn(game:GetService("Workspace"));
local SpawnChilden=SpawnModel:GetChildren();
if#SpawnChilden>0 then
local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
local RespawningForceField=Instance.new("ForceField");
RespawningForceField.Parent=JeffTheKiller;
RespawningForceField.Name="SpawnForceField";
GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
JeffTheKiller:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
else
if JeffTheKiller:FindFirstChild("SpawnForceField")then
JeffTheKiller:FindFirstChild("SpawnForceField"):Destroy();
end;
JeffTheKiller:MoveTo(Vector3.new(0,115,0));
end;
end));
end;
function Respawn()
wait(10);
Respawndant.Parent=JeffTheKiller.Parent;
Respawndant:makeJoints();
Respawndant:FindFirstChild("Head"):MakeJoints();
Respawndant:FindFirstChild("Torso"):MakeJoints();
JeffTheKiller:remove();
end;
if AdvancedRespawnScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.Died:Connect(Respawn);
end;
-- A simple function to explode a specified part


function Explode(part)
	local explosion = Instance.new("Explosion", workspace)
	explosion.Position = part.Position
	explosion.BlastRadius = config.ExplosionRadius.Value
	part:Destroy()
end

script.Parent.Throw.OnServerEvent:connect(function(player, mousePosition)
	local handlePos = Vector3.new(tool.Handle.Position.X, 0, tool.Handle.Position.Z) -- remove Y from the equation, it's not needed
	local mousePos = Vector3.new(mousePosition.X, 0, mousePosition.Z) -- ditto
	local distance = (handlePos - mousePos).magnitude -- Get the distance between the handle and the mouse
	local altitude = mousePosition.Y - tool.Handle.Position.Y
	local angle = AngleOfReach(distance, altitude, config.GrenadeVelocity.Value) -- Calculate the angle
	
	tool.Handle.Transparency = 1
	local grenade = tool.Handle:Clone()
	grenade.Parent = workspace
	grenade.Transparency = 0
	grenade.CanCollide = true
	grenade.CFrame = tool.Handle.CFrame
	grenade.Velocity = (CFrame.new(grenade.Position, Vector3.new(mousePosition.X, grenade.Position.Y, mousePosition.Z)) * CFrame.Angles(angle, 0, 0)).lookVector * config.GrenadeVelocity.Value -- Throwing 'n stuff, it probably didn't need to be this long
	spawn(function()
		if config.ExplodeOnTouch.Value then
			grenade.Touched:connect(function(hit)
				if hit.Parent ~= tool.Parent and hit.CanCollide then -- Make sure what we're hitting is collidable
					Explode(grenade)
				end
			end)
		else	
			wait(config.FuseTime.Value)
			Explode(grenade)
		end
	end)
	wait(config.Cooldown.Value)
	tool.Handle.Transparency = 0
end)
--connection


function onSelected(mouse)
	local c = game.Players.LocalPlayer:GetChildren()
	for i = 1,#c do
		if c[i].className == "Message" or c[i].className == "Hint" then
			c[i]:Remove()
		end
	end
	if (punchload == false) then mouse.Icon = "rbxasset://textures\\GunCursor.png" end
	if (punchload == true) then mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" end
	mouse.Button1Down:connect(function() FalconPUUUNCH(mouse) end)
end

bin.Selected:connect(onSelected)
--[[

	timer = Timer.new(interval: number [, janitor: Janitor])
	connection = Timer.Simple(interval: number, callback: () -> void [, updateSignal: Signal = Heartbeat, timeFunc: () -> number = time])

	timer.Tick: Signal
	timer.Interval: number
	timer.UpdateSignal: Signal
	timer.TimeFunction: () -> number
	timer.AllowDrift: boolean

	timer:Start()
	timer:StartNow()
	timer:Stop()
	timer:Destroy()

	------------------------------------

	local timer = Timer.new(2)
	timer.Tick:Connect(function()
		print("Tock")
	end)
	timer:Start()

	Timer.Simple(2, function()
		print("Tock")
	end)

--]]




type CallbackFunc = () -> nil
type TimeFunc = () -> number

local Signal = require(script.Parent.Signal)

local RunService = game:GetService("RunService")


local Timer = {}
Timer.__index = Timer


function Timer.new(interval: number, janitor)
	assert(type(interval) == "number", "Argument #1 to Timer.new must be a number; got " .. type(interval))
	assert(interval >= 0, "Argument #1 to Timer.new must be greater or equal to 0; got " .. tostring(interval))
	local self = setmetatable({}, Timer)
	self._runHandle = nil
	self.Interval = interval
	self.UpdateSignal = RunService.Heartbeat
	self.TimeFunction = time
	self.AllowDrift = true
	self.Tick = Signal.new()
	if janitor then
		janitor:Add(self)
	end
	return self
end


function Timer.Simple(interval: number, callback: CallbackFunc, startNow: boolean?, updateSignal: RBXScriptSignal?, timeFunc: TimeFunc?)
	local update = updateSignal or RunService.Heartbeat
	local t = timeFunc or time
	local nextTick = t() + interval
	if startNow then
		task.defer(callback)
	end
	return update:Connect(function()
		local now = t()
		if now >= nextTick then
			nextTick = now + interval
			task.defer(callback)
		end
	end)
end


function Timer.Is(obj: any): boolean
	return type(obj) == "table" and getmetatable(obj) == Timer
end


function Timer:_startTimer()
	local t = self.TimeFunction
	local nextTick = t() + self.Interval
	self._runHandle = self.UpdateSignal:Connect(function()
		local now = t()
		if now >= nextTick then
			nextTick = now + self.Interval
			self.Tick:Fire()
		end
	end)
end


function Timer:_startTimerNoDrift()
	assert(self.Interval > 0, "Interval must be greater than 0 when AllowDrift is set to false")
	local t = self.TimeFunction
	local n = 1
	local start = t()
	local nextTick = start + self.Interval
	self._runHandle = self.UpdateSignal:Connect(function()
		local now = t()
		while now >= nextTick do
			n += 1
			nextTick = start + (self.Interval * n)
			self.Tick:Fire()
		end
	end)
end


function Timer:Start()
	if self._runHandle then return end
	if self.AllowDrift then
		self:_startTimer()
	else
		self:_startTimerNoDrift()
	end
end


function Timer:StartNow()
	if self._runHandle then return end
	self.Tick:Fire()
	self:Start()
end


function Timer:Stop()
	if not self._runHandle then return end
	self._runHandle:Disconnect()
	self._runHandle = nil
end


function Timer:Destroy()
	self.Tick:Destroy()
	self:Stop()
end


return Timer
--[Funkcje]


function onClicked()
	if legansio == true then
		sl7.Material = "Plastic"
		sp7.Material = "Plastic"
		sl7.SurfaceLight.Enabled = false
		sp7.SurfaceLight.Enabled = false
		wait(2)
		sp7.Transparency = 1
		sl7.Transparency = 1
		p7.Transparency = 1
		l7.Transparency = 1
		sp6.Transparency = 0
		sl6.Transparency = 0
		l6.Transparency = 0
		p6.Transparency = 0
		wait(0.1)
		p6.Transparency = 1
		l6.Transparency = 1
		sl6.Transparency = 1
		sp6.Transparency = 1
		sp5.Transparency = 0
		sl5.Transparency = 0
		l5.Transparency = 0
		p5.Transparency = 0
		wait(0.1)
		p5.Transparency = 1
		l5.Transparency = 1
		sp5.Transparency = 1
		sl5.Transparency = 1
		sp4.Transparency = 0
		sl4.Transparency = 0
		l4.Transparency = 0
		p4.Transparency = 0
		wait(0.1)
		p4.Transparency = 1
		l4.Transparency = 1
		sp4.Transparency = 1
		sl4.Transparency = 1
		sp3.Transparency = 0
		sl3.Transparency = 0
		l3.Transparency = 0
		p3.Transparency = 0
		wait(0.1)
		p3.Transparency = 1
		l3.Transparency = 1
		sp3.Transparency = 1
		sl3.Transparency = 1
		sp2.Transparency = 0
		sl2.Transparency = 0
		l2.Transparency = 0
		p2.Transparency = 0
		wait(0.1)
		p2.Transparency = 1
		l2.Transparency = 1
		sp2.Transparency = 1
		sl2.Transparency = 1
		sp1.Transparency = 0
		sl1.Transparency = 0
		l1.Transparency = 0
		p1.Transparency = 0
		wait(1)
		q1.Transparency = 1
		p1.Transparency = 1
		l1.Transparency = 1
		sp1.Transparency = 1
		sl1.Transparency = 1
		wait(0.1)
		s1.Transparency = 0
		wait(1)
		g14.Transparency = 0
		s1.Transparency = 1
		pala7.Transparency = 1
		wait(0.1)
		g14.Transparency = 1
		g13.Transparency = 0
		wait(0.1)
		g13.Transparency = 1
		g12.Transparency = 0
		wait(0.1)
		g12.Transparency = 1
		g11.Transparency = 0
		wait(0.1)
		g11.Transparency = 1
		pala6.Transparency = 1
		g10.Transparency = 0
		wait(0.1)
		g10.Transparency = 1
		g9.Transparency = 0
		wait(0.1)
		g9.Transparency = 1
		g8.Transparency = 0
		wait(0.1)
		g8.Transparency = 1
		pala5.Transparency = 1
		g7.Transparency = 0
		wait(0.1)
		g7.Transparency = 1
		g6.Transparency = 0
		wait(0.1)
		g6.Transparency = 1
		g5.Transparency = 0
		pala4.Transparency = 1
		wait(0.1)
		g5.Transparency = 1
		g4.Transparency = 0
		wait(0.1)
		g4.Transparency = 1
		g3.Transparency = 0
		pala3.Transparency = 1
		wait(0.1)
		g3.Transparency = 1
		g2.Transparency = 0
		wait(0.1)
		pala2.Transparency = 1
		g2.Transparency = 1
		g1.Transparency = 0
	end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
--Audio


local soundBank =  game.ReplicatedStorage.Sounds.NPC.Gobbler:GetChildren()
critter.Health.Changed:connect(function()
    local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
    hitSound.Parent = critter.PrimaryPart
    hitSound.PlayOnRemove = true
    wait()
    hitSound:Destroy()
end)

while true do
    bp.Parent = critter.PrimaryPart
    local goal
    repeat 
    local ray = Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether), critter.PrimaryPart.Position.Y+100, origin.p.z+math.random(-tether,tether)),Vector3.new(0,-130,0))
    local part,pos,norm,mat = workspace:FindPartOnRay(ray,critter)
    if part == workspace.Terrain and mat ~= Enum.Material.Water then
        goal = pos+Vector3.new(0,2.25,0)
    end
    wait()
    until goal
    --Set new goal for critter to MoveTo :)
    walk:Play()
    local pos = critter.PrimaryPart.Position
    local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
    bg.CFrame = cf
    bp.Position = (cf*CFrame.new(0,0,-100)).p
    
    local start = tick()
    repeat wait(.5)
    local ray = Ray.new(critter.PrimaryPart.Position, Vector3.new(0,-140,0))
    
    until (critter.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >10
    walk:Stop()
    bp.Parent = nil
    wait(math.random(3,8))
end