Roblox/luau_corpus huggingface dataset:
-- Release all loaded profiles when the server is shutting down:
task.spawn(function()
	WaitForLiveAccessCheck()
	Madwork.ConnectToOnClose(
		function()
			ProfileService.ServiceLocked = true
			-- 1) Release all active profiles: --
			-- Clone AutoSaveList to a new table because AutoSaveList changes when profiles are released:
			local on_close_save_job_count = 0
			local active_profiles = {}
			for index, profile in ipairs(AutoSaveList) do
				active_profiles[index] = profile
			end
			-- Release the profiles; Releasing profiles can trigger listeners that release other profiles, so check active state:
			for _, profile in ipairs(active_profiles) do
				if profile:IsActive() == true then
					on_close_save_job_count = on_close_save_job_count + 1
					task.spawn(function() -- Save profile on new thread
						SaveProfileAsync(profile, true)
						on_close_save_job_count = on_close_save_job_count - 1
					end)
				end
			end
			-- 2) Yield until all active profile jobs are finished: --
			while on_close_save_job_count > 0 or ActiveProfileLoadJobs > 0 or ActiveProfileSaveJobs > 0 do
				task.wait()
			end
			return -- We're done!
		end,
		UseMockDataStore == false -- Always run this OnClose task if using Roblox API services
	)
end)

return ProfileService
--[[Engine (Avxnturador)]]

	-- Everything below can be illustrated and tuned with the graph below.
	-- https://www.desmos.com/calculator/oishj9m1tq
	-- This includes everything, from the engines, to boost, to electric.
	
	-- To import engines prior to AC6C V1.3, consult the README.
	
	-- Naturally Aspirated Engine
	Tune.Engine 		= true		
		
		Tune.Horsepower		= 249	-- Naturally aspirated horsepower, before adding forced induction
		Tune.IdleRPM		= 650	-- Engine idle
		Tune.PeakRPM		= 4800	-- Where horsepower reaches peak
		Tune.Redline		= 6000	-- Your engine's rev limiter
		Tune.PeakSharpness	= 45	-- How fast power drops off past peak horsepower
		Tune.CurveMult		= .5	-- Higher values mean a peakier power curve, lower values being smoother
		Tune.EqPoint		= 5252	-- Standardized, do not touch

		Tune.CompressionRatio	= 8.5 -- Only affects cars with forced induction, Google this value
	
	-- Electric Engine
	Tune.Electric		= false
		
		Tune.E_Redline	= 12700
		Tune.E_Trans1	= 4000
		Tune.E_Trans2	= 7000
		-- Horsepower
		Tune.E_Horsepower	= 223
		Tune.EH_FrontMult	= 0.15
		Tune.EH_EndMult		= 2.9
		Tune.EH_EndPercent	= 7
		-- Torque
		Tune.E_Torque		= 286
		Tune.ET_EndMult		= 1.505
		Tune.ET_EndPercent	= 27.5
		
	-- Turbocharger
	Tune.Turbochargers	= 2				-- Number of turbochargers in the engine, set to 0 for no turbochargers
										
		Tune.T_Boost		= 7
		Tune.T_BoostLag		= 125		-- Turbo lag overall
		Tune.T2_BoostLag	= 250		-- (ONLY ACTIVE ON TWIN TURBO CARS) Second turbo lag, equal to the first turbo lag or greater if you're using sequential turbos
		
	-- Supercharger
	Tune.Superchargers	= 0				-- Number of superchargers in the engine
										-- Set to 0 for no superchargers
		Tune.S_Boost		= 7
		Tune.S_Sensitivity	= 0.05		-- Supercharger responsiveness/sensitivity, applied per tick (recommended values between 0.05 to 0.1)
		
	--Misc
	Tune.ThrotAccel		= .05		-- Throttle acceleration, applied per tick (recommended values between 0.05 to 0.1)
	Tune.ThrotDecel		= .2		-- Throttle deceleration, applied per tick (recommended values between 0.1 to 0.3)
	
	Tune.BrakeAccel		= .2		-- Brake acceleration, applied per tick
	Tune.BrakeDecel		= .5		-- Brake deceleration, applied per tick
	
	Tune.RevAccel		= 250		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 250		-- RPM kickback from redline
	
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.Flywheel		= 500		-- Flywheel weight (higher = faster response, lower = more stable RPM)
	
	Tune.InclineComp	= 1			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--	W.C0 = C0
	--W.C1 = C1
	W.Parent = x
	
end

local anim = nil 
local handle = nil	
local namehide = Instance.new("BoolValue")
namehide.Name = "HideName"
			handle = Tool.Handle

Tool.Equipped:connect(function()
	
			Tool.Handle.Sound:Play()
			handle.Parent = char
			weldTogether(handle, char.Torso) 
			namehide.Parent = hum.Effects
			if anim ~= nil then
				anim:Stop()
			end
			anim = hum:LoadAnimation(script.BoxHide) 
			anim:Play() 
		
end)


Tool.Unequipped:connect(function()
		if anim ~= nil then
				anim:Stop()
		end
		handle.Parent = Tool  
		namehide.Parent = nil
	
end)
----
local FOV = 10					-- HOW MUCH YOU WANT CAMERA TO ZOOM IN.  70 IS DEFAULT.  SMALLER NUMBER = MORE ZOOM
local cooldowntime = .0		-- HOW LONG BEFORE THEY CAN ZOOM IN/OUT AGAIN.
local KEYBIND = Enum.KeyCode.R	-- CHANGE E TO WHATEVER KEY YOU WANT THEM TO PRESS TO ZOOM.
--// Services
local L_98_ = game:GetService('RunService').RenderStepped
local L_99_ = game:GetService('UserInputService')
-- Decompiled with the Synapse X Luau decompiler.

local v1 = {};
local v2 = {};
v2.__index = v2;
function v2.GetInstance(p1, p2)
	if p1.InstancePoolsByClass[p2] == nil then
		p1.InstancePoolsByClass[p2] = {};
	end;
	local v3 = #p1.InstancePoolsByClass[p2];
	if not (v3 > 0) then
		return Instance.new(p2);
	end;
	table.remove(p1.InstancePoolsByClass[p2]);
	return p1.InstancePoolsByClass[p2][v3];
end;
function v2.ReturnInstance(p3, p4)
	if p3.InstancePoolsByClass[p4.ClassName] == nil then
		p3.InstancePoolsByClass[p4.ClassName] = {};
	end;
	if not (#p3.InstancePoolsByClass[p4.ClassName] < p3.PoolSizePerType) then
		p4:Destroy();
		return;
	end;
	table.insert(p3.InstancePoolsByClass[p4.ClassName], p4);
end;
function v1.new(p5)
	local v4 = setmetatable({}, v2);
	v4.InstancePoolsByClass = {};
	v4.Name = "ObjectPool";
	v4.PoolSizePerType = p5;
	return v4;
end;
return v1;
-------------------------------

local tool = script.Parent
local player = game.Players.LocalPlayer
while player.Character == nil do wait() end
local char = player.Character
while char:FindFirstChild("Humanoid") == nil do wait() end
local hum = char:FindFirstChild("Humanoid")
local mouse = player:GetMouse()

local going = false
local enabled = true
local equipped = false

function stoppedGoing(mouse)
	if going then
		going = false
		script.Parent.Stopped:FireServer()
		wait(RELOAD_TIME)
		if equipped then
			mouse.Icon = "rbxasset://textures\\GunCursor.png"
		end
		enabled = true
	end
end

tool.Selected:connect(function(mouse)
	equipped = true
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function()
		if hum == nil then return end
		if hum.Health <= 0 then return end
		if mouse == nil then return end
		if enabled then
			if not going then
				if mouse.Hit ~= nil then
					enabled = false
					going = true
					script.Parent.Start:FireServer(mouse.Hit.p)
					mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
				end
			end
		end
	end)
	mouse.Button1Up:connect(function()
		stoppedGoing(mouse)
	end)
end)

tool.Deselected:connect(function()
	equipped = false
	stoppedGoing(mouse)
end)
-----------------
--| Variables |--
-----------------

local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')

local MyPlayer = PlayersService.LocalPlayer

local Tool = script.Parent
local ToolHandle = Tool.Handle

local RocketScript = WaitForChild(script, 'Rocket')
local SwooshSound = WaitForChild(script, 'Swoosh')
local BoomSound = WaitForChild(script, 'Boom')
-- constants

local PLAYER	= Players.LocalPlayer

return function(character)
	local rootPart	= character.UpperTorso
	
	for _, v in pairs(character:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Transparency	= 1
		elseif v:IsA("Decal") then
			v.Transparency	= 1
		end
	end
	
	local emitter	= script.TicketEmitter:Clone()
		emitter.Parent	= rootPart
		
	emitter:Emit(60)
end
--Player leaving > save data and remove server data about player
function module:RemovePlayerData(player)
	if main.pd[player] then
		savePlayerData(player, true)
	end
	main.pd[player] = nil
end
--// Animations
local L_165_

function IdleAnim(L_335_arg1)
	L_24_.IdleAnim(L_3_, L_165_, {
		L_45_,
		L_46_,
		L_47_
	});
end;

function EquipAnim(L_336_arg1)
	L_24_.EquipAnim(L_3_, L_165_, {
		L_45_
	});
end;

function UnequipAnim(L_337_arg1)
	L_24_.UnequipAnim(L_3_, L_165_, {
		L_45_
	});
end;

function FireModeAnim(L_338_arg1)
	L_24_.FireModeAnim(L_3_, L_165_, {
		L_45_,
		L_47_,
		L_46_,
		L_55_
	});
end

function ReloadAnim(L_339_arg1)
	L_24_.ReloadAnim(L_3_, L_165_, {
		L_45_,
		L_46_,
		L_47_,
		L_58_,
		L_3_:WaitForChild('Left Arm'),
		L_55_,
		L_49_,
		L_3_:WaitForChild('Right Arm'),
		L_43_
	});
end;

function BoltingBackAnim(L_340_arg1)
	L_24_.BoltingBackAnim(L_3_, L_165_, {
		L_49_
	});
end

function BoltingForwardAnim(L_341_arg1)
	L_24_.BoltingForwardAnim(L_3_, L_165_, {
		L_49_
	});
end

function BoltingForwardAnim(L_342_arg1)
	L_24_.BoltingForwardAnim(L_3_, L_165_, {
		L_49_
	});
end

function BoltBackAnim(L_343_arg1)
	L_24_.BoltBackAnim(L_3_, L_165_, {
		L_49_,
		L_47_,
		L_46_,
		L_45_,
		L_59_
	});
end

function BoltForwardAnim(L_344_arg1)
	L_24_.BoltForwardAnim(L_3_, L_165_, {
		L_49_,
		L_47_,
		L_46_,
		L_45_,
		L_59_
	});
end

function InspectAnim(L_345_arg1)
	L_24_.InspectAnim(L_3_, L_165_, {
		L_47_,
		L_46_
	});
end

function nadeReload(L_346_arg1)
	L_24_.nadeReload(L_3_, L_165_, {
		L_46_,
		L_47_
	});
end

function AttachAnim(L_347_arg1)
	L_24_.AttachAnim(L_3_, L_165_, {
		L_46_,
		L_47_
	});
end

function PatrolAnim(L_348_arg1)
	L_24_.PatrolAnim(L_3_, L_165_, {
		L_46_,
		L_47_
	});
end
--Connect our event. The function wants to know the start and end teleporter, and the part that triggered the teleport.
networking.StartEffect.OnClientEvent:connect(function(part,tele1,tele2)
	local parts = {}
	getAssemblyParts(part,parts) --Get the entire assembly
	
	local soundPart1 = tele1:clone()
	soundPart1.Transparency = 1
	soundPart1.Parent = camera
	
	local soundPart2 = tele2:clone()
	soundPart2.Transparency = 1
	soundPart2.Parent = camera
	
	soundPart1.Teleport:play()
	soundPart2.Teleport:play()
	
	local effect1 = {}
	local effect2 = {}
	
	for _,pt in pairs(parts) do
		local part = pt:clone()
		part.Anchored = true
		part.CanCollide = false
		part.Transparency = 1
		part.Material = Enum.Material.Neon
		pcall(function() part.FormFactor = Enum.FormFactor.Custom end)
		part.Size = part.Size * 1.1
		part.Parent = camera
		effect1[part] = pt.CFrame
		
		local part = pt:clone()
		part.Anchored = true
		part.CanCollide = false
		part.Transparency = 1
		part.Material = Enum.Material.Neon
		pcall(function() part.FormFactor = Enum.FormFactor.Custom end)
		part.Size = part.Size * 1.1
		part.Parent = camera
		effect2[part] = tele2.CFrame * tele1.CFrame:toObjectSpace(pt.CFrame)
	end
	
	local start = tick()
	while tick() < start+4 do
		wait()
		local t = tick()-start
		local x = t*(2.31/4)
		
		local trans = -0.7*x^3 + 2.6*x^2 - 2.7*x + 1
		tele1.Parent.Glow.Transparency = 1 - math.pow((x - 2.25) / 2.25,2)
		tele2.Parent.Glow.Transparency = 1 - math.pow((x - 2.25) / 2.25,2)
		
		for k,v in pairs(effect1) do
			k.CFrame = v
			k.Transparency = trans
		end
		for k,v in pairs(effect2) do
			k.CFrame = v
			k.Transparency = trans
		end
	end
	local tele1color = tele1.Parent.Glow.BrickColor
	local tele2color = tele2.Parent.Glow.BrickColor
	
	tele1.Parent.Glow.BrickColor = BrickColor.new("Pastel light blue")
	tele2.Parent.Glow.BrickColor = BrickColor.new("Pastel light blue")
	
	wait(0.05)
	
	tele1.Parent.Glow.BrickColor = tele1color
	tele2.Parent.Glow.BrickColor = tele2color
	
	wait(0.45)
	
	local start = tick()
	while tick() < start+1 do
		wait()
		local t = tick()-start
		local trans = t
		
		tele1.Parent.Glow.Transparency = 1-t
		
		for k,v in pairs(effect1) do
			k.Size = k.Size * 1.01
			k.CFrame = v
			k.Transparency = trans
		end
		for k,v in pairs(effect2) do
			k.Size = k.Size * 1.01
			k.CFrame = v
			k.Transparency = trans
		end
	end
	
	for k,v in pairs(effect1) do k:Destroy() end
	for k,v in pairs(effect2) do k:Destroy() end
	
	tele1.Parent.Glow.Transparency = 0
	
	soundPart1:Destroy()
	soundPart2:Destroy()
end)
--//hood
local hd = Instance.new("Motor", script.Parent.Parent.Misc.HD.SS)
hd.MaxVelocity = 0.03
hd.Part0 = script.Parent.HD
hd.Part1 = hd.Parent
-- Hook up CreateIndicator bindable function

bfCreateIndicator.OnInvoke = function (position, time, radius)
	assert(position, "requires arg #1 position")
	assert(time, "requires arg #2 time")
	assert(radius, "requires arg #3 radius")
	return Indicator:new{time = time; position = position; radius = radius}
end
--[=[
	@param serviceName string
	@return Service
	Gets the service by name. Throws an error if the service is not found.
]=]
function KnitServer.GetService(serviceName: string): Service
	assert(type(serviceName) == "string", "ServiceName must be a string; got " .. type(serviceName))
	return assert(services[serviceName], "Could not find service \"" .. serviceName .. "\"") :: Service
end
--[[
	Fired when state is left
]]
function Transitions.onLeavePreGame(stateMachine, event, from, to)
	ServerPreGame.leave(stateMachine)
end
--create the dustcloud object
--[[local prt = Instance.new("Part")
prt.Size = Vector3.new(1,1,1)
prt.BrickColor = BrickColor.new(217)
prt.Anchored = true
prt.CanCollide = false
script.Parent.CloudMesh.Parent = prt]]
--[[local msh = Instance.new("SpecialMesh")
msh.MeshId = "http://www.roblox.com/asset/?id=1095708"
msh.MeshType = 5
msh.Parent = prt]]


function WaitForChild(obj, ch_n)
	local t = time()
	while not obj:FindFirstChild(ch_n) and time() - t < 10 do wait(0.1) end
	return obj:FindFirstChild(ch_n)
end
-- connect up

function stopLoopedSounds()
	sRunning:Stop() 
	sClimbing:Stop()
	sSwimming:Stop()
end

Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Swimming:connect(onSwimming)
Humanoid.Climbing:connect(onClimbing)
Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
Humanoid.FallingDown:connect(function(state) stopLoopedSounds() onStateNoStop(state, sFallingDown) prevState = "Falling" end)
Humanoid.StateChanged:connect(function(old, new) 
	if not (new.Name == "Dead" or 
			new.Name == "Running" or 
			new.Name == "RunningNoPhysics" or 
			new.Name == "Swimming" or 
			new.Name == "Jumping" or 
			new.Name == "GettingUp" or 
			new.Name == "FallingDown") then
		stopLoopedSounds()
	end
end)
--[[
	CameraModule - This ModuleScript implements a singleton class to manage the
	selection, activation, and deactivation of the current camera controller,
	character occlusion controller, and transparency controller. This script binds to
	RenderStepped at Camera priority and calls the Update() methods on the active
	controller instances.

	The camera controller ModuleScripts implement classes which are instantiated and
	activated as-needed, they are no longer all instantiated up front as they were in
	the previous generation of PlayerScripts.

	2018 PlayerScripts Update - AllYourBlox
--]]

local CameraModule = {}
CameraModule.__index = CameraModule

local FFlagUserRemoveTheCameraApi do
	local success, result = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserRemoveTheCameraApi")
	end)
	FFlagUserRemoveTheCameraApi = success and result
end
---------------
--// Functions
---------------
local function resetGUI()
	for i,v in pairs(script.Parent:GetChildren()) do
		if v:IsA("Frame") and v.Name ~= "Template" and v.Name ~= "A" then
			v:Destroy()
		end
	end
end 

local function loadGUI(plr)
	for i,v in pairs(Players:GetPlayers()) do
		local clone = script.Parent.Template:Clone()
		clone.Parent = script.Parent
		clone.Name = ""
		clone.ImageLabel.Image = "rbxthumb://type=AvatarHeadShot&id="..plr.UserId.."&w=150&h=150"
		clone.Usernaame.Text = v.Name
		clone.TextButton.MouseButton1Down:Connect(function()
			if debounce == false then
				debounce = true
				local plot = workspace.Plots.Plot:FindFirstChild("Plot"..plr:GetAttribute("Plot"))
				local tween = TweenService:Create(LocalPlayer.Character.HumanoidRootPart, TweenInfo.new(.1), {["CFrame"] = plot.Pos.CFrame, })
				tween:Play()
				tween.Completed:Wait()
				task.wait(.5)
				debounce = false
			end
		end)
	end
end


local function updateGUI()
	resetGUI()
	loadGUI()
end
-- How many velocities we want to store in our velocity history. Each velocity is stored per frame.
-- Used to ensure we have a correct recent velocity.
local MAX_VELOCITY_HISTORY_COUNT = 5

local previousVelocities = {}

local function getAverageVelocity()
	local averageVelocity = Vector3.new()

	for _, v in pairs(previousVelocities) do
		averageVelocity = averageVelocity + v
	end

	averageVelocity = averageVelocity / #previousVelocities
	return averageVelocity
end

local counter = 1
--Gets called on both client and server
function ChickynoidStyle:Setup(simulation)

    --Dont need to set anything, the defaults should basically be this
end

return ChickynoidStyle
--// Graphing functions \\--

local function graphPoint(t : number, ... : Vector3) : Vector3
	assert(t >= 0 and t <= 1, t .. "t is not between 0 and 1.")
	local points = {...}
	local n : number = #points - 1
	local p : Vector3 = nil
	for i = 0, n do
		local x = binomial(n,i)*(1 - t)^(n-i) * t^i * points[i+1] 
		p = p and p + x or x
	end
	return p
end
--[[[Default Controls]]
	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 10		,	-- Mouse steering deadzone (0 - 100%)
		
		ControlLDZone			= 5			,	-- Controller steering L-deadzone (0 - 100%)
		ControlRDZone			= 5			,	-- Controller steering R-deadzone (0 - 100%)
	}
	
	--Control Mapping
	Tune.Controls = {
		
	--Keyboard Controls
		--Mode Toggles
		ToggleTCS				= Enum.KeyCode.T					,
		ToggleABS				= Enum.KeyCode.Y					,
		ToggleTransMode			= Enum.KeyCode.M					,
		ToggleMouseDrive		= Enum.KeyCode.R					,
		
		--Primary Controls
		Throttle				= Enum.KeyCode.W					,
		Brake					= Enum.KeyCode.S					,
		SteerLeft				= Enum.KeyCode.A					,
		SteerRight				= Enum.KeyCode.D   				    ,
		
		--Secondary Controls
		Throttle2				= Enum.KeyCode.B 					,
		Brake2					= Enum.KeyCode.N					,
		SteerLeft2				= Enum.KeyCode.M 	 				,
		SteerRight2				= Enum.KeyCode.V					,
		
		--Manual Transmission
		ShiftUp					= Enum.KeyCode.E					,
		ShiftDown				= Enum.KeyCode.Q					,
		Clutch					= Enum.KeyCode.LeftShift     			,
		
		--Handbrake
		PBrake					= Enum.KeyCode.P			,
		
	--Mouse Controls
		MouseThrottle			= Enum.UserInputType.MouseButton1	,
		MouseBrake				= Enum.UserInputType.MouseButton2	,
		MouseClutch				= Enum.KeyCode.W					,
		MouseShiftUp			= Enum.KeyCode.E					,
		MouseShiftDown			= Enum.KeyCode.Q					,
		MousePBrake				= Enum.KeyCode.LeftShift			,
		
	--Controller Mapping
		ContlrThrottle			= Enum.KeyCode.ButtonR2				,
		ContlrBrake				= Enum.KeyCode.ButtonL2				,
		ContlrSteer				= Enum.KeyCode.Thumbstick1			,
		ContlrShiftUp			= Enum.KeyCode.ButtonY				,
		ContlrShiftDown			= Enum.KeyCode.ButtonX				,
		ContlrClutch			= Enum.KeyCode.ButtonR1				,
		ContlrPBrake			= Enum.KeyCode.ButtonL1				,
		ContlrToggleTMode		= Enum.KeyCode.DPadUp				,
		ContlrToggleTCS			= Enum.KeyCode.DPadDown				,
		ContlrToggleABS			= Enum.KeyCode.DPadRight			,
	}
-- Bind tool events
Tool.Equipped:connect(equip)
Tool.Unequipped:connect(unequip)
---Misfire reduces turbo Lag when it happens and also might increace your car boost -----
----Misfire advanced settings are in it's own plugin 
--- Messing with them is at your own risk only do if you know how things work :spicy:
---Come back In the next version For SuperCharger Support Maybe ----
--[[Misc]]
	Tune.LoadDelay		= .1		-- Delay before initializing chassis (in seconds)
	Tune.AutoStart		= true		-- Set to false if using manual ignition plugin
	Tune.AutoFlip		= true		-- Set to false if using manual flip plugin
--// Probabilities
	JamChance = 0; -- This is percent scaled. For 100% Chance of jamming, put 100, for 0%, 0; and everything inbetween
	TracerChance = 17; -- This is the percen scaled. For 100% Chance of showing tracer, put 100, for 0%, 0; and everything inbetween
--	print("CurrentAnim ", currentAnim, " ", frameName)
	if (frameName == "End") then
		if currentAnim == "walk" then
			runAnimTrack.TimePosition = 0.0
			currentAnimTrack.TimePosition = 0.0
		else
	--		print("Keyframe : ".. frameName)
	
			local repeatAnim = currentAnim
			-- return to idle if finishing an emote
			if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
				repeatAnim = "idle"
			end
			
			local animSpeed = currentAnimSpeed
			playAnimation(repeatAnim, 0.15, Humanoid)
			setAnimationSpeed(animSpeed)
		end
	end
end

function rollAnimation(animName)
	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
	return idx
end

function playToyAnimation(AnimName) 
	local ToyObject = Figure:FindFirstChild("Toy");
	
	if ( ToyObject and ToyObject:FindFirstChild("AnimationController") ) then
		
		local AnimController = ToyObject.AnimationController;
		local AnimObject = ToyObject.AnimationObjects:FindFirstChild(AnimName);
		if ( AnimObject ) then
			
			if ( CurrentToyAnimation ~= nil ) then
				CurrentToyAnimation:Stop();
				CurrentToyAnimation:Destroy();
				CurrentToyAnimation = nil;
			end
			
			local AnimTrack = AnimController.Animator:LoadAnimation( AnimObject );
			AnimTrack:Play();
			CurrentToyAnimation = AnimTrack;
		end
		
	end
	
end

function playAnimation(animName, transitionTime, humanoid) 
		
	local idx = rollAnimation(animName)
---------------------------------------------------------------
-- 
-- крутим лопастями 
-- 
---------------------------------------------------------------
local Players = game:GetService("Players") -- берём ссылку на список игроков

me=script.Parent
plr=Players:FindFirstChild(me.Owner.Value)


angle=0 -- угол поворота
DELTA=me.Config.SpeedAttack.Value + me.Config.SpeedAttackAdd.Value * plr.VAR.turSpeed.Value

local hits=script.Hit:Clone()
--attack function
function attack()
	for i,v in pairs(workspace:GetChildren()) do
		if v:FindFirstChild("Humanoid") then
			if v ~= script.Parent then
				if (v.Head.Position - script.Parent.Head.Position).Magnitude < damagerange then
					v.Humanoid:TakeDamage(damage)
				end
			end
		end
	end
	wait(0.3)
end
function heardetect(part)
	local target = nil
	local Beam = Instance.new("Part", script.debris)
	Beam.Anchored = true
	Beam.CanCollide = false
	Beam.Color = Color3.fromRGB(255, 150, 150)
	Beam.Material = Enum.Material.Neon
	Beam.Name = "LaserBeam"
	Beam.Transparency = 1
	local Object = script.Parent.Head
	local Raycast = Ray.new(Object.CFrame.p, CFrame.new(Object.CFrame.Position, part.Position).LookVector * distance)
	local Part, Position = game.Workspace:FindPartOnRayWithIgnoreList(Raycast, {Object, Beam, script.debris}, false, true)
	local Distance = (Object.CFrame.p - Position).Magnitude
	if visibleray == true then
		Beam.Size = Vector3.new(0.1, 0.1, Distance)
		Beam.CFrame = CFrame.new(Object.CFrame.Position, part.Position) * CFrame.new(0, 0, -Distance/2)
		Beam.Transparency = 0
	else
		Beam:Destroy()
	end
	if Part ~= nil then
		if game.Players:GetPlayerFromCharacter(Part.Parent) or game.Players:GetPlayerFromCharacter(Part.Parent.Parent) then
			--script.Parent.Humanoid:MoveTo(Part.Position)
			GoTo(part.Position)
			if (part.Position - script.Parent.Head.Position).Magnitude < damagerange then
				attack()
			end
			Beam.BrickColor = BrickColor.new("Bright blue")
		else
			Beam.BrickColor = BrickColor.new("Really red")
		end
	else
		Beam.BrickColor = BrickColor.new("White")
	end
	wait()
end
while wait() do
	local maxDistance = distance
	for i,v in pairs(workspace:GetChildren()) do
		if v:FindFirstChild("Humanoid") then
			if (v.Head.Position-script.Parent.Head.Position).magnitude < maxDistance then
				if v ~= script.Parent then
					heardetect(v.Head)
				end
			else
				wander()
			end
		end
	end
end