Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[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.
-------------------------------



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
--[[
	ROBLOX deviation: ReactFiberHostConfig captures singleton state across the
	whole workspace. This file and the modules it requires were moved from React
	to untangle a cyclic workspace member dependency.

	Before:
	* ReactFiberHostConfig (and the 5 associated modules) lived in React
	* React had a dependency on Shared
	* Shared reached into React source to re-export ReactFiberHostConfig (cycle)

	After:
	* ReactFiberHostConfig (and the 5 associated modules) live in Shared
	* React depends on Shared
	* Shared has no intra-workspace dependencies (no cycles)
]]
--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)
--[=[
	@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
--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)
---------------
--// 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
--// 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			,
	}
---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
--	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
--- Creates callbacks and sets up initial state.


function ScopeHierarchyItemButton:init()
    self.Maid = Maid.new()
    self.LayoutRef = Roact.createRef()
    self.ContainerSize, self.UpdateContainerSize = Roact.createBinding(UDim2.new(0, 0, 1, 0))

    --- Processes clicks, triggers scope change
    function self.OnClicked()
        self.props.SetScopeFromButton(self.props.Instance)
    end

    -- Set initial state
    self:UpdateInstanceState()
end

local ClassIconPositions = {
    Part = Vector2.new(2, 1);
    MeshPart = Vector2.new(4, 8);
    UnionOperation = Vector2.new(4, 8);
    NegateOperation = Vector2.new(3, 8);
    VehicleSeat = Vector2.new(6, 4);
    Seat = Vector2.new(6, 4);
    TrussPart = Vector2.new(2, 1);
    CornerWedgePart = Vector2.new(2, 1);
    WedgePart = Vector2.new(2, 1);
    SpawnLocation = Vector2.new(6, 3);
    Model = Vector2.new(3, 1);
    Folder = Vector2.new(8, 8);
    Tool = Vector2.new(8, 2);
    Workspace = Vector2.new(10, 2);
    Accessory = Vector2.new(3, 4);
    Accoutrement = Vector2.new(3, 4);
}
-- Anything parented to this script's parent will be lit up!


 
MaxFlickerWait = 30
MinFlickerWait = 10
Allow = false
function Change(Mode)
    for _,i in pairs (script.Parent:GetChildren()) do
        if i:IsA("BasePart") then
            if Mode then
                i.Material = "Neon"
            else
                i.Material = "SmoothPlastic"
            end
        elseif i:IsA("Model") then
            for _,i in pairs (i:GetChildren()) do
                if Mode then
                    i.Material = "Neon"
                else
                    i.Material = "SmoothPlastic"
                end
            end
        end
    end
end
script.On.Changed:connect(function()
    if script.On.Value then
        Allow = true
        Change(true)
    else
        Allow = false
        Change(false)
    end
end)
while wait(math.random(MinFlickerWait,MaxFlickerWait)) do
    if Allow then
        local function Check() if not Allow then return end end
        local WaitTime = .5
        Change(false)
        wait(WaitTime/2); Check();
        Change(true)
        wait(WaitTime); Check()
        Change(false)
        wait(WaitTime*1.5); Check()
        Change(true)
        wait(WaitTime); Check()
        Change(false)
        wait(WaitTime/5); Check()
        Change(true)
        wait(WaitTime); Check()
        Change(false)
        wait(WaitTime/8); Check()
        Change(true)
    end
end
--[[
	Hides all ScreenGuis and CoreGuis shown. If the callback `hideOtherGuis`
	is defined then that function is called instead.
]]


function GuiController:hideGuis()
	if self.hideOtherGuis and self.hideOtherGuis.isCallbackSet() then
		self.hideOtherGuis.fireCallback()
		return
	end

	-- hideGuis has already been called, no need to hide again until
	-- showGuis is called
	if #Cryo.Dictionary.keys(self.disabledGuis) ~= 0 then
		return
	end

	-- Hide ScreenGuis
	self.disabledGuis = self:_getOtherScreenGuis()
	for _, gui in ipairs(self.disabledGuis) do
		gui.Enabled = false
	end

	-- Hide CoreGuis
	self.disabledCoreGuis = self:_getShownCoreGuis()
	for _, gui in ipairs(self.disabledCoreGuis) do
		self.StarterGui:SetCoreGuiEnabled(gui, false)
	end

	-- Hide mobile controls
	self.modalEnabled = self.UserInputService.ModalEnabled
	self.UserInputService.ModalEnabled = true
end
-- functions



function stopAllAnimations()
	local oldAnim = currentAnim

	-- return to idle if finishing an emote
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
		oldAnim = "idle"
	end

	currentAnim = ""
	currentAnimInstance = nil
	if (currentAnimKeyframeHandler ~= nil) then
		currentAnimKeyframeHandler:disconnect()
	end

	if (currentAnimTrack ~= nil) then
		currentAnimTrack:Stop()
		currentAnimTrack:Destroy()
		currentAnimTrack = nil
	end

	-- clean up walk if there is one
	if (runAnimKeyframeHandler ~= nil) then
		runAnimKeyframeHandler:disconnect()
	end
	
	if (runAnimTrack ~= nil) then
		runAnimTrack:Stop()
		runAnimTrack:Destroy()
		runAnimTrack = nil
	end
	
	return oldAnim
end

local smallButNotZero = 0.0001
function setRunSpeed(speed)
	if speed < 0.33 then
		currentAnimTrack:AdjustWeight(1.0)		
		runAnimTrack:AdjustWeight(smallButNotZero)
	elseif speed < 0.66 then
		local weight = ((speed - 0.33) / 0.33)
		currentAnimTrack:AdjustWeight(1.0 - weight + smallButNotZero)
		runAnimTrack:AdjustWeight(weight + smallButNotZero)
	else
		currentAnimTrack:AdjustWeight(smallButNotZero)
		runAnimTrack:AdjustWeight(1.0)
	end
	
	local speedScaled = speed * 1.25
	runAnimTrack:AdjustSpeed(speedScaled)
	currentAnimTrack:AdjustSpeed(speedScaled)
	
	if ( CurrentToyAnimation ~= nil ) then
		CurrentToyAnimation:AdjustSpeed(speedScaled)
	end
	
end


function setAnimationSpeed(speed)
	
	-- Check difference
	local MaxDifference = .5;
	local Difference = math.abs(( currentAnimSpeed - speed ));
	
	if ( Difference < MaxDifference ) then
		return;
	end
	
	if speed ~= currentAnimSpeed then
		currentAnimSpeed = speed
		if currentAnim == "walk" then
			setRunSpeed(speed)
		else
			currentAnimTrack:AdjustSpeed(currentAnimSpeed)
		end
	end
end

function keyFrameReachedFunc(frameName)