Roblox/luau_corpus huggingface dataset:
--[[
	Server Module
--]]

local Settings = { --, not ; ? | server module!!
	 BulletHoleTexture = 'http://www.roblox.com/asset/?id=64291961'
	,Damage = {35, 45}
	,OneHanded = false --DONT USE YET
	,FakeArms = true
    ,FakeArmTransparency = 0
    ,RightPos = CFrame.new(-1,0.7,0.45) * CFrame.Angles(math.rad(-90), 0, 0)
	,LeftPos = CFrame.new(0.8,0.8,0.3) * CFrame.Angles(math.rad(-90), math.rad(45), 0)
}

return Settings
--script.Parent.SS.Velocity = script.Parent.SS.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.SSS.Velocity = script.Parent.SSS.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.T.Velocity = script.Parent.T.CFrame.lookVector *script.Parent.Speed.Value
--[[ Private Functions ]]--

local function disableButton()
	JumpButton.Visible = false
	OnInputEnded()
end

local function enableButton()
	if Humanoid and ExternallyEnabled then
		if ExternallyEnabled then
			if Humanoid.JumpPower > 0 then
				JumpButton.Visible = true
			end
		end
	end
end

local function updateEnabled()
	if JumpPower > 0 and JumpStateEnabled then
		enableButton()
	else
		disableButton()
	end
end

local function humanoidChanged(prop)
	if prop == "JumpPower" then
		JumpPower =  Humanoid.JumpPower
		updateEnabled()
	elseif prop == "Parent" then
		if not Humanoid.Parent then
			HumChangeConnection:disconnect()
		end
	end
end

local function humandoidStateEnabledChanged(state, isEnabled)
	if state == Enum.HumanoidStateType.Jumping then
		JumpStateEnabled = isEnabled
		updateEnabled()
	end
end

local function characterAdded(newCharacter)
	if HumChangeConnection then
		HumChangeConnection:disconnect()
	end
	-- rebind event to new Humanoid
	Humanoid = nil
	repeat
		Humanoid = MasterControl:GetHumanoid()
		wait()
	until Humanoid and Humanoid.Parent == newCharacter
	HumChangeConnection = Humanoid.Changed:connect(humanoidChanged)
	HumStateConnection = Humanoid.StateEnabledChanged:connect(humandoidStateEnabledChanged)
	JumpPower = Humanoid.JumpPower
	JumpStateEnabled = Humanoid:GetStateEnabled(Enum.HumanoidStateType.Jumping)
	updateEnabled()
end

local function setupCharacterAddedFunction()
	CharacterAddedConnection = LocalPlayer.CharacterAdded:connect(characterAdded)
	if LocalPlayer.Character then
		characterAdded(LocalPlayer.Character)
	end
end
--local Oldtargpos = targpos

local OldPos = torsoPos * 2
local origin = CFrame.new(torsoPos)

local Logic = 0
local OldX = 100
local OldZ = 0
local Xdir = 100
local Zdir = 0
local ClimbingLadder = false
local FreeFalling = false
local GraphicsOn = script.GraphicsToggle.Value -- Only set at start
--- water

workspace.Terrain.WaterTransparency = 1
workspace.Terrain.WaterReflectance = 0.2

sky = script.Sky
sky.Parent = Lighting




local Blur = Instance.new("BlurEffect")
Blur.Parent = game.Lighting
Blur.Size = 25
wait(0.1)
Blur.Size = 24
wait(0.1)
Blur.Size = 23
wait(0.1)
Blur.Size = 22
wait(0.1)
Blur.Size = 21
wait(0.1)
Blur.Size = 20
wait(0.1)
Blur.Size = 19
wait(0.1)
Blur.Size = 18
wait(0.1)
Blur.Size = 17
wait(0.1)
Blur.Size = 16
wait(0.1)
Blur.Size = 15
wait(0.1)
Blur.Size = 14
wait(0.1)
Blur.Size = 13
wait(0.1)
Blur.Size = 12
wait(0.1)
Blur.Size = 11
wait(0.1)
Blur.Size = 10
wait(0.1)
Blur.Size = 9
wait(0.1)
Blur.Size = 8
wait(0.1)
Blur.Size = 7
wait(0.1)
Blur.Size = 6
wait(0.1)
Blur.Size = 5
wait(0.1)
Blur.Size = 4
wait(0.1)
Blur.Size = 3
wait(0.1)
Blur.Size = 2
wait(0.1)
Blur.Size = 1
wait(0.1)
Blur.Size = 0




print('Loading..Bloom')
wait(2)
print('Loading..Lens Flares')


print("Done!")


while wait(1) do
	for i,v in pairs(game.Players:GetPlayers()) do
		if v.PlayerGui:FindFirstChild("LensFlareGui") == nil then
			gui = script.LensFlareGui:Clone()
			gui.Parent = v.PlayerGui
		end
	end
end
------------------------------------------------------------------------
-- prepares error message for display, for limits exceeded
-- * used only in checklimit()
------------------------------------------------------------------------
function luaY:errorlimit(fs, limit, what)
  local msg = (fs.f.linedefined == 0) and
    string.format("main function has more than %d %s", limit, what) or
    string.format("function at line %d has more than %d %s",
                  fs.f.linedefined, limit, what)
  luaX:lexerror(fs.ls, msg, 0)
end
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Snowball-- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)
--
	script.Parent.Handle2.Hinge1.Transparency = 0
	script.Parent.Handle2.Interactive1.Transparency = 0
	script.Parent.Handle2.Part1.Transparency = 0
-- Ring5 descending
for l = 1,#lifts5 do
	if (lifts5[l].className == "Part") then
	lifts5[l].BodyPosition.position = Vector3.new((lifts5[l].BodyPosition.position.x),(lifts5[l].BodyPosition.position.y-8),(lifts5[l].BodyPosition.position.z))
	end
end
wait(0.1)
for p = 1,#parts5 do
	parts5[p].CanCollide = false
end
wait(0.1)

wait(1)
localdeb.Value = false
foreigndeb.Value = false

end
end

script.Parent.Touched:connect(onTouched)
--Physics and maintaining height--
core.spawn(function()
	while myHuman.Health > 0 do
		if engineRunning then
			flight.physics()
			flight.maintainHeight(desiredHeight,target)
		end
		wait()
	end
end)
--!strict
local function slice(str: string, startIndexStr: string | number, lastIndexStr: (string | number)?): string
	local strLen, invalidBytePosition = utf8.len(str)
	assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition)))
	local startIndex = tonumber(startIndexStr)
	assert(typeof(startIndex) == "number", "startIndexStr should be a number")

	if startIndex + strLen < 0 then
		-- then |start index| is greater than string length
		startIndex = 1
	end

	if startIndex > strLen then
		return ""
	end

	-- if no last index length set, go to str length + 1
	local lastIndex = strLen + 1
	if lastIndexStr ~= nil then
		-- ROBLOX FIXME: add parseInt to encapsulate this logic and use it here
		local NaN = 0 / 0
		lastIndex = tonumber(lastIndexStr) or NaN -- this works because 0 is truthy in Lua
	end
	assert(typeof(lastIndex) == "number", "lastIndexStr should convert to number")

	if lastIndex > strLen then
		lastIndex = strLen + 1
	end

	local startIndexByte = utf8.offset(str, startIndex)
	-- get char length of charset retunred at offset
	local lastIndexByte = utf8.offset(str, lastIndex) - 1

	return string.sub(str, startIndexByte, lastIndexByte)
end

return slice
--RangeWarned
--* called when the server notifies that the client attempted
--* to start a dialogue that was too far away (ConversationDistance).
function Interface.RangeWarned()
	
end
--[[Transmission]]
	Tune.TransModes		= {"Auto", "Semi"}								--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "Manual"}								
		>First mode is default mode													]]
	
	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)
	
	--Gear Ratios
	Tune.FinalDrive		= 3.06			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3.70		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		3.53		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.04		,
		--[[ 3 ]]		1.38		,
		--[[ 4 ]]		1.03		,
		--[[ 5 ]]		0.81		,
		--[[ 6 ]]		0.64		,
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
------- extreme math equations
		local v = 30
		local c = 50
		local m = part:GetMass()
		if m< 20 then
			m = 20
		end
		part.RotVelocity =Vector3.new(math.random(-v,v)/(m/c),math.random(-v,v)/(m/c),math.random(-v,v)/(m/c))
		game:GetService("Debris"):AddItem(script.Parent,0.1)--penetration
	
	end
	local a = part.Parent:findFirstChild("Humanoid")
	local b = part.Parent.Parent:findFirstChild("Humanoid")
		local debrispart = Instance.new("Part")
		debrispart.Name="debrispart"
		debrispart.Size = Vector3.new(0.05,0.05,0.05)
		debrispart.BrickColor = part.BrickColor
		debrispart.Anchored=true
		debrispart.CanCollide = false
		debrispart.Transparency=1
		debrispart.Position=positiono
		debrispart.Parent=game.Workspace
		if a == nil and b == nil then
		local thingy = script.debris:Clone()
		thingy.Color=ColorSequence.new(part.Color,part.Color)
		thingy.Parent=debrispart
		spawn(function()
		thingy:Emit(10)
		end)
		end
		if a ~= nil or b ~= nil then
		local thingy = script.blood:Clone()
		thingy.Parent=debrispart
		spawn(function()
		thingy:Emit(10)
		end)
		end
		game:GetService("Debris"):AddItem(debrispart,1)
		game:GetService("Debris"):AddItem(script.Parent,0.05)
		
	--[[if position ~= nil then
	end]]--
	end
end

	script.Parent.Touched:connect(hit)
--[[**
	Determines if the passed object is a Janitor.
	@param [t:any] Object The object you are checking.
	@returns [t:boolean] Whether or not the object is a Janitor.
**--]]
function Janitor.Is(Object)
	return type(Object) == "table" and getmetatable(Object) == Janitor
end
--R6
MakeWeld(car.Misc.Anims.R6.RightArm.Z,car.Misc.Anims.R6.RightArm.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.RightArm.Y,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.RightArm.Parts,misc.Anims.R6.RightArm.Z)
MakeWeld(car.Misc.Anims.R6.LeftArm.Z,car.Misc.Anims.R6.LeftArm.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.LeftArm.Y,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.LeftArm.Parts,misc.Anims.R6.LeftArm.Z)

MakeWeld(car.Misc.Anims.R6.LeftLeg.X,car.Misc.Anims.R6.LeftLeg.Z,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.LeftLeg.Z,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.LeftLeg.Parts,misc.Anims.R6.LeftLeg.X)

MakeWeld(car.Misc.Anims.R6.RightLeg.X,car.Misc.Anims.R6.RightLeg.Z,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.RightLeg.Z,car.Misc.Anims.R6.RightLeg.I,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.RightLeg.I,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.RightLeg.Parts,misc.Anims.R6.RightLeg.X)

MakeWeld(car.Misc.Anims.R6.Torso.Z,car.DriveSeat,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.Torso.X,car.Misc.Anims.R6.Torso.Z,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.Torso.Parts,misc.Anims.R6.Torso.X)

MakeWeld(car.Misc.Anims.R6.Head.X,car.Misc.Anims.R6.Head.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.Head.Y,car.Misc.Anims.R6.Head.Z,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.Head.Z,car.Misc.Anims.R6.Torso.X,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.Head.Parts,misc.Anims.R6.Head.X)
-----------------------------------------------------------------------------

script.Parent.Humanoid.HealthChanged:Connect(function()
	if script.Parent.Humanoid.Health <= 37 then
		
		Instance.new("Decal", script.Parent.Head)
		script.Parent.Head.Decal.Texture = "rbxassetid://176678128"
		script.Parent.Head.Decal.Face = "Front"
	end
end)
--[[Brakes]]
	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 3000		-- Front brake force
	Tune.RBrakeForce	= 2500		-- Rear brake force
	Tune.PBrakeForce	= 99999		-- Handbrake force
	
	Tune.FLgcyBForce	= 41000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 36000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 150000    -- Handbrake force [PGS OFF]
--local Text = thirstGui:WaitForChild("Back"):WaitForchild("Text")
local plr = game.Players.LocalPlayer

repeat wait() until plr.Character -- waiting for player to load

local UIS = game:GetService("UserInputService")
local hum = plr.Character:WaitForChild("Humanoid")
local maxThirst = 100
local maxHunger = 100
local thirstValue
local hungerValue

if plr:FindFirstChild("HungerVal") then
	hungerValue = plr.HungerVal
	hungerValue.Value = maxHunger
else
	Instance.new("IntValue", plr).Name = "HungerVal"
	plr.HungerVal.Value = maxHunger
	hungerValue = plr.HungerVal
end

if plr:FindFirstChild("ThirstVal") then
	thirstValue = plr.ThirstVal
	thirstValue.Value = maxThirst
else
	Instance.new("IntValue", plr).Name = "ThirstVal"
	plr.ThirstVal.Value = maxThirst
	thirstValue = plr.ThirstVal
end

local hungerValue = plr:WaitForChild("HungerVal")
local Frame = thirstGui.Frame

local TS = game:GetService("TweenService")

thirstValue.Changed:connect(function()



	if thirstValue.Value > 60 then
		TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,255),ImageTransparency = 1}):Play()
	elseif thirstValue.Value <= 0 then
		MedicSys.Fome:FireServer()
	elseif thirstValue.Value <= 30 then
		TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,((thirstValue.Value/30)*255),((thirstValue.Value/60)*255)),ImageTransparency = 0}):Play()
	elseif thirstValue.Value <= 60 then
		TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,((thirstValue.Value/60)*255)),ImageTransparency = 0}):Play()
	end
end)


hungerValue.Changed:connect(function()

	if hungerValue.Value > 60 then
		TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,255),ImageTransparency = 1}):Play()
	elseif hungerValue.Value <= 0 then
		MedicSys.Fome:FireServer()
	elseif hungerValue.Value <= 30 then
		TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,((hungerValue.Value/30)*255),((hungerValue.Value/60)*255)),ImageTransparency = 0}):Play()
	elseif hungerValue.Value <= 60 then
		TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,((hungerValue.Value/60)*255)),ImageTransparency = 0}):Play()
	end
end)


while wait(ServerConfig.HungerWaitTime) do

	if thirstValue.Value - 1 >= 0 then
		thirstValue.Value = thirstValue.Value - 1
	end

	if hungerValue.Value - 1 >= 0 then
		hungerValue.Value = hungerValue.Value - 1
	end
	
end
-- Show highlight on currently equipped tool in toolbar
EquippedVal.Changed:connect(function()
	for i,v in pairs(UiFrame:GetChildren()) do
		if v:IsA('ImageButton') then
			v.BorderSizePixel = 1
		end
	end
	if EquippedVal.Value then
		local imageButton = UiFrame:FindFirstChild(EquippedVal.Value.Name)
		if imageButton then
			imageButton.BorderSizePixel = 4
		end
	end
end)

for i,v in pairs(UiFrame:GetChildren()) do
	if v:IsA("ImageButton") then
		v.MouseButton1Click:Connect(function()
			local slotRequested = SlotsFolder:FindFirstChild(v.Name)
				if slotRequested then -- if there is such a slot
					-- if they're requesting the same slot
					if EquippedVal.Value == slotRequested then 
						EquippedVal.Value = nil -- unequip the tool
					else
						EquippedVal.Value = slotRequested -- equip the tool
					end
				end
		end)
	end
end

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
--[ FUNCTIONS ]--

if not AFKEvent then
	AFKEvent = Instance.new("RemoteEvent")
	AFKEvent.Parent = game.ReplicatedStorage
	AFKEvent.Name = "AFK"
end

local updateAFK = function(player,enable)
	
	local GUI = player.Character:WaitForChild("HumanoidRootPart"):WaitForChild("OverheadGui")
	local AFKTagT = GUI:WaitForChild("Username")
	
	if enable then
		AFKTagT.Text = "AFK | "..player.Name.." (@"..player.DisplayName..")"
	else
		AFKTagT.Text = player.Name.." (@"..player.DisplayName..")"
	end
end


AFKEvent.OnServerEvent:Connect(function(player,enable)
	AFKStatus[player] = enable
	updateAFK(player,enable)
end)
--[=[
	Connects a handler to a ScriptSignal object, but only allows that
	connection to run once. Any `:Fire` calls called afterwards won't trigger anything.

	```lua
	ScriptSignal:ConnectOnce(function()
		print("Connection fired")
	end)

	ScriptSignal:Fire()
	ScriptSignal:Fire()

	-- "Connection fired" is only fired once
	```

	@param handler (...: any) -> ()
	@ignore
]=]
function ScriptSignal:ConnectOnce(
	handler: (...any) -> ()
)
	assert(
		typeof(handler) == 'function',
		"Must be function"
	)

	local connection
	connection = self:Connect(function(...)
		connection:Disconnect()
		handler(...)
	end)
end
-- Functions

local function getRotationBetween(u, v, axis)
	local dot, uxv = u:Dot(v), u:Cross(v)
	if (dot < -0.99999) then return CFrame.fromAxisAngle(axis, math.pi) end
	return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
end
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
local function BoostSetup()	
	local Speedometer = gui:WaitForChild("Speedometer")
	local Bar = Speedometer:WaitForChild("Bar")
	local SpeedBar = Bar:WaitForChild("SpeedBar")

	function GuiController:UpdateBoost(boostAmount)
		local boostPercentage = math.clamp(boostAmount/engine._settings.BoostAmount, 0, 1)
		Bar.Position = UDim2.new(-1 + boostPercentage, 0, 0, 0)
		SpeedBar.Position = UDim2.new(1 - 1*boostPercentage, 0, 0, 0)
	end
end -- BoostSetup()
-- Denotes property change handlers in an instance's property table.
export type OnChangeKey = Symbol & {
	-- name: "OnChange" (add this when Luau supports singleton types)
	key: string
}
-- Buy case #1

BuyCasesEvents.Case1.OnServerEvent:Connect(function(player, PricePoints, PriceGems, PointsBuy)
	if PointsBuy == true then
		if player.DataFolder.Points.Value >= PricePoints then
			player.DataFolder.Points.Value -= PricePoints
			print(PricePoints)
			--Transaction Completed
			player.Inventory.BatCase1.Value += 1 --Choose the case
		else
			MessagesEvents.NotEnoughPoints:FireClient(player)
		end
	elseif PointsBuy == false then
		if player.DataFolder.Gems.Value >= PriceGems then
			player.DataFolder.Gems.Value -= PriceGems
			print(PriceGems)
			--Transaction Completed
			player.Inventory.BatCase1.Value += 1 --Case
		else
			MessagesEvents.NotEnoughPoints:FireClient(player)
		end

	end
end)

OpenCasesEvents.OpenCase1.OnServerEvent:Connect(function(player)
	if player.Inventory.BatCase1.Value > 0 then
		player.Inventory.BatCase1.Value -= 1
		OpenCasesEvents.OpenCase1:FireClient(player)
	else
		MessagesEvents.CaseNotOwned:FireClient(player)
	end
end)
--Setup fast joiners
spawn(function()
	wait(1)
	for _,player in pairs(main.players:GetChildren()) do
		if not main.pd[player] and not settingUpPlayer[player] then
			playerAdded(player)
		end
	end
end)




return module
--- Maps arguments #2-n through callback and returns values as tuple
function Util.Each(callback, ...)
	local results = {}
	for i, value in ipairs({...}) do
		results[i] = callback(value)
	end
	return unpack(results)
end
--////////////////////////////////////////////////////////////////////////////////////////////
--///////////////////////////////////////////////// Code to hook client UI up to server events
--////////////////////////////////////////////////////////////////////////////////////////////

function DoChatBarFocus()
	if (not ChatWindow:GetCoreGuiEnabled()) then return end
	if (not ChatBar:GetEnabled()) then return end

	if (not ChatBar:IsFocused() and ChatBar:GetVisible()) then
		moduleApiTable:SetVisible(true)
		InstantFadeIn()
		ChatBar:CaptureFocus()
		moduleApiTable.ChatBarFocusChanged:fire(true)
	end
end

chatBarFocusChanged.Event:connect(function(focused)
	moduleApiTable.ChatBarFocusChanged:fire(focused)
end)

function DoSwitchCurrentChannel(targetChannel)
	if (ChatWindow:GetChannel(targetChannel)) then
		ChatWindow:SwitchCurrentChannel(targetChannel)
	end
end

function SendMessageToSelfInTargetChannel(message, channelName, extraData)
	local channelObj = ChatWindow:GetChannel(channelName)
	if (channelObj) then
		local messageData =
		{
			ID = -1,
			FromSpeaker = nil,
			SpeakerUserId = 0,
			OriginalChannel = channelName,
			IsFiltered = true,
			MessageLength = string.len(message),
			MessageLengthUtf8 = utf8.len(utf8.nfcnormalize(message)),
			Message = trimTrailingSpaces(message),
			MessageType = ChatConstants.MessageTypeSystem,
			Time = os.time(),
			ExtraData = extraData,
		}

		channelObj:AddMessageToChannel(messageData)
	end
end

function chatBarFocused()
	if (not mouseIsInWindow) then
		DoBackgroundFadeIn()
		if (textIsFaded) then
			DoTextFadeIn()
		end
	end

	chatBarFocusChanged:Fire(true)
end
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"

function populatehumanoids(mdl)
	if mdl.ClassName=="Humanoid" then
		table.insert(humanoids,mdl)
	end
	for i2,mdl2 in ipairs(mdl:GetChildren()) do
		populatehumanoids(mdl2)
	end
end

while Figure.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Figure.Head and Torso~=nil and Torso.Parent~=nil do
	local _,time=wait(0.1)
	humanoids={}
	populatehumanoids(game.Workspace)
	closesttarget=nil
	closestdist=sightrange
	local creator=Figure:FindFirstChild("creator")
	for i,h in ipairs(humanoids) do
		if h and h.Parent~=nil then
			if h.Health>0 and h.Parent.Name~=Figure.Name and h.Parent~=Figure then
				local plr=game.Players:GetPlayerFromCharacter(h.Parent)
				if creator==nil or plr==nil or creator.Value~=plr then
					local t=h.Parent:FindFirstChild("Torso")
					if t~=nil then
						local dist=(t.Position-Torso.Position).magnitude
						if dist<closestdist then
							closestdist=dist
							closesttarget=t
						end
					end
				end
			end
		end
	end
	if closesttarget~=nil then
		if not chasing then
			chasing=true
			Figure.canAttack.Value=true
			Humanoid.WalkSpeed=runspeed
		end
		Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
		if math.random()<.5 then
			--attack(time,closesttarget.Position)
		end
	else
		if chasing then
			chasing=false
			Figure.canAttack.Value=false
			Humanoid.WalkSpeed=wonderspeed
		end
		if time>nextrandom then
			nextrandom=time+3+(math.random()*5)
			local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
			Humanoid:MoveTo(randompos,game.Workspace.Terrain)
		end
	end
	if time>nextjump then
		nextjump=time+7+(math.random()*5)
		Humanoid.Jump=true
	end
	--animate(time)
	move(time)
end

wait(4)
Figure:remove()
-- Dont touch
while wait() do
	script.Parent.Rotation = script.Parent.Rotation + 15
	if script.Parent.Rotation == 360 then
		script.Parent.Rotation = 0
	end
end