Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[ Touch Events ]]

--
UserInputService.Changed:connect(function(property)
	if property == 'ModalEnabled' then
		IsModalEnabled = UserInputService.ModalEnabled

		if lastInputType == Enum.UserInputType.Touch then
			if ControlState.Current == ControlModules.Touch and IsModalEnabled then
				ControlState:SwitchTo(nil)
			elseif ControlState.Current == nil and not IsModalEnabled then
				ControlState:SwitchTo(ControlModules.Touch)
			end
		end
	end
end)

if FFlagUserNoCameraClickToMove then
	BindableEvent_OnFailStateChanged = MasterControl:GetClickToMoveFailStateChanged()
end
if BindableEvent_OnFailStateChanged then
	BindableEvent_OnFailStateChanged.Event:connect(function(isOn)
		if lastInputType == Enum.UserInputType.Touch and ClickToMoveTouchControls then
			if isOn then
				ControlState:SwitchTo(ClickToMoveTouchControls)
			else
				ControlState:SwitchTo(nil)
			end
		end
	end)
end

local switchToInputType = function(newLastInputType)
	lastInputType = newLastInputType

	if VRService.VREnabled then
		ControlState:SwitchTo(ControlModules.VRNavigation)
		return
	end

	if lastInputType == Enum.UserInputType.Touch then
		ControlState:SwitchTo(ControlModules.Touch)
	elseif lastInputType == Enum.UserInputType.Keyboard or
		lastInputType == Enum.UserInputType.MouseButton1 or
		lastInputType == Enum.UserInputType.MouseButton2 or
		lastInputType == Enum.UserInputType.MouseButton3 or
		lastInputType == Enum.UserInputType.MouseWheel or
		lastInputType == Enum.UserInputType.MouseMovement  then
		ControlState:SwitchTo(ControlModules.Keyboard)
	elseif lastInputType == Enum.UserInputType.Gamepad1 or
		lastInputType == Enum.UserInputType.Gamepad2 or
		lastInputType == Enum.UserInputType.Gamepad3 or
		lastInputType == Enum.UserInputType.Gamepad4 then
		ControlState:SwitchTo(ControlModules.Gamepad)
	end
end

if IsTouchDevice then
	createTouchGuiContainer()
end

MasterControl:Init()

UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
	local connectedGamepads = UserInputService:GetConnectedGamepads()
	if #connectedGamepads > 0 then return end

	if not VRService.VREnabled then
		if UserInputService.KeyboardEnabled then
			ControlState:SwitchTo(ControlModules.Keyboard)
		elseif IsTouchDevice then
			ControlState:SwitchTo(ControlModules.Touch)
		end
	end
end)

UserInputService.GamepadConnected:connect(function(gamepadEnum)
	if not VRService.VREnabled then
		ControlState:SwitchTo(ControlModules.Gamepad)
	end
end)

switchToInputType(UserInputService:GetLastInputType())
UserInputService.LastInputTypeChanged:connect(switchToInputType)

VRService.Changed:connect(function(prop)
	if prop ~= "VREnabled" then
		return
	end

	if VRService.VREnabled then
		ControlState:SwitchTo(ControlModules.VRNavigation)
	end
end)
-- Gradually regenerates the Humanoid's Health over time.


local Character = script.Parent
local Humanoid = Character:WaitForChild'Humanoid'
Humanoid.MaxHealth = 130
local val = 130

local REGEN_RATE = .3/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = .25 -- Wait this long between each regeneration step.
--------RIGHT DOOR --------



game.Workspace.doorright.l13.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(1003)
--		end
--	end
--end





function brakes()
	if Values.Brake.Value > 0.01 then 
		LightEvent:FireServer("BrakeLights", Rear_Light_Type, Brake_Light_Brightness, 0.02, Trunk_Lights)
	else
		LightEvent:FireServer("BrakeLights", Rear_Light_Type, 0, 1, Trunk_Lights)
	end
end

function reverse()
	if Values.Gear.Value == -1 then
		LightEvent:FireServer("Reverse", Reverse_Light_Type, Reverse_Light_Brightness, 0.02, Trunk_Lights)
	else
		LightEvent:FireServer("Reverse", Reverse_Light_Type, 0, 1, Trunk_Lights)
	end
end

function leavedriveseat()
	LightEvent:FireServer("IndsOnLeave", LI.Value, RI.Value, H.Value, Sequential_Indicators, Sequential_Segments, Indicator_Flash_Rate, Indicator_Type)
end
--- Window handles the command bar GUI


local Window = {
	Valid = true,
	AutoComplete = nil,
	ProcessEntry = nil,
	OnTextChanged = nil,
	Cmdr = nil,
	HistoryState = nil,
}

local Gui = Player:WaitForChild("PlayerGui"):WaitForChild("Cmdr"):WaitForChild("Frame")
local Line = Gui:WaitForChild("Line")
local Entry = Gui:WaitForChild("Entry")

Line.Parent = nil
--[[ Initialization/Setup ]]

--
local function createTouchGuiContainer()
	if TouchGui then TouchGui:Destroy() end
	
	-- Container for all touch device guis
	TouchGui = Instance.new('ScreenGui')
	TouchGui.Name = "TouchGui"
	TouchGui.ResetOnSpawn = false
	TouchGui.Parent = PlayerGui
	
	TouchControlFrame = Instance.new('Frame')
	TouchControlFrame.Name = "TouchControlFrame"
	TouchControlFrame.Size = UDim2.new(1, 0, 1, 0)
	TouchControlFrame.BackgroundTransparency = 1
	TouchControlFrame.Parent = TouchGui
	
	ThumbstickModule:Create(TouchControlFrame)
	DPadModule:Create(TouchControlFrame)
	ThumbpadModule:Create(TouchControlFrame)
	TouchJumpModule:Create(TouchControlFrame)
	DynamicThumbstickModule:Create(TouchControlFrame)
end
--Function For Making New Ray Bricks


function makeRay(cframe, size)
	local p						= Instance.new("Part")
	p.Name						= "RayPart"
	p.BrickColor				= BrickColor.new("Bright green")
	p.Transparency				= 0.5
	p.Anchored					= true
	p.CanCollide				= false
	p.TopSurface				= Enum.SurfaceType.Smooth
	p.BottomSurface				= Enum.SurfaceType.Smooth
	p.formFactor				= Enum.FormFactor.Custom
	p.CFrame					= cframe
	p.Size						= size
	p.Parent					= m
	ignoreList[#ignoreList+1]	= p
end



round					= Instance.new("Part")
round.Name				= "RayPart"
round.Transparency		= 0.5
round.Anchored			= true
round.CanCollide		= false
round.TopSurface		= Enum.SurfaceType.Smooth
round.BottomSurface		= Enum.SurfaceType.Smooth
round.formFactor		= Enum.FormFactor.Custom
round.BrickColor		= BrickColor.new("Black")
yOffset					= -0.2
-- Made by the owner of Kiwami Development


repeat wait() until char ~= nil

while wait() do
	local health = char.Health
	local f = health/100
	script.Parent.HP.Value = health
	script.Parent.HealthBar:TweenSize(UDim2.new(f,0,0.654,0),"Out","Quint",0.25)
	script.Parent.TextLabel.Text = "+ "..script.Parent.HP.Value
	script.Parent.PlayerLabel.Text = plr.DisplayName

	if health <= 5 then
		script.Parent.HealthBar.BackgroundColor3 = Color3.fromRGB(94, 0, 0)
		script.Parent.TextLabel.TextColor3 = Color3.fromRGB(94, 0, 0)
		script.Parent.PlayerLabel.TextColor3 = Color3.fromRGB(94, 0, 0)
		script.Parent.HP.Value = "5"
	elseif health <= 20 then
		script.Parent.HealthBar.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
		script.Parent.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
		script.Parent.PlayerLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
		script.Parent.HP.Value = "20"
	elseif health <= 50 then
		script.Parent.HealthBar.BackgroundColor3 = Color3.fromRGB(255, 85, 0)
		script.Parent.TextLabel.TextColor3 = Color3.fromRGB(255, 85, 0)
		script.Parent.PlayerLabel.TextColor3 = Color3.fromRGB(255, 85, 0)
		script.Parent.HP.Value = "50"
	elseif health <= 75 then
		script.Parent.HealthBar.BackgroundColor3 = Color3.fromRGB(255, 183, 0)
		script.Parent.TextLabel.TextColor3 = Color3.fromRGB(255, 183, 0)
		script.Parent.PlayerLabel.TextColor3 = Color3.fromRGB(255, 183, 0)
		script.Parent.HP.Value = "75"
	elseif health > 75 then
		script.Parent.HealthBar.BackgroundColor3 = Color3.fromRGB(0, 200, 255)
		script.Parent.TextLabel.TextColor3 = Color3.fromRGB(0, 200, 255)
		script.Parent.PlayerLabel.TextColor3 = Color3.fromRGB(0, 200, 255)
		script.Parent.HP.Value = "75"	
	end
	if health == 0 then
		script.Parent.HP.Value = "0"
	end
end

function HealthChanged(health)
end

char.HealthChanged:connect(HealthChanged)

if error then
	script:reload()
end
-- ROBLOX FIXME Luau: should infer this function a Plugin | nil, with no warnings


local function findPlugin(plugins: Plugins, val: any): Plugin | nil
	for _, p in ipairs(plugins) do
		local ok, ret = pcall(p.test, val)
		if not ok then
			error(PrettyFormatPluginError(ret))
		elseif ret then
			return p
		end
	end

	return nil
end

function printer(
	val: any,
	config: Config,
	indentation: string,
	depth: number,
	refs: Refs,
	hasCalledToJSON: boolean?
): string
	local plugin_ = findPlugin(config.plugins, val)
	if plugin_ ~= nil then
		return printPlugin(plugin_, val, config, indentation, depth, refs)
	end

	local basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString)
	if basicResult ~= nil then
		return basicResult
	end

	return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON)
end
-----------------------------------------------------------------------------------------------



script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
script.Parent:WaitForChild("Needle")
script.Parent:WaitForChild("Brake")

local player=game.Players.LocalPlayer
local mouse=player:GetMouse()

local car = script.Parent.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false

local _Tune = require(car["A-Chassis Tune"])

local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline

local currentUnits = 0
local revEnd = math.ceil(_lRPM/1000)

script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
	local gearText = script.Parent.Parent.Parent.Values.Gear.Value
	if gearText == 0 then gearText = "N"
	elseif gearText == -1 then gearText = "R"
	end
	script.Parent.Gear.Text = gearText
end)

script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()
	script.Parent.Needle.Rotation = 230 * math.min(1,script.Parent.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)

script.Parent.Parent.Parent.Values.Velocity.Changed:connect(function(property)
	script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Parent.Values.Velocity.Value.Magnitude)
end)

local function nextUnity ()
	if currentUnits==#UNITS then
		currentUnits = 1
	else
		currentUnits = currentUnits+1
	end
	script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Parent.Values.Velocity.Value.Magnitude)
	script.Parent.Unit.Text = UNITS[currentUnits].units
end

script.Parent.Speed.MouseButton1Click:connect(function()
	nextUnity()
end)
nextUnity()

script.Parent.Parent.Parent.Values.PBrake.Changed:connect(function()
	script.Parent.Brake.Visible = script.Parent.Parent.Parent.Values.PBrake.Value
end)

wait(.1)
-- Knit modifies roblox-lua-promise to add PascalCase API


Promise.Defer = Promise.defer
Promise.Async = Promise.defer
Promise.Resolve = Promise.resolve
Promise.Reject = Promise.reject
Promise.Try = Promise.try
Promise.All = Promise.all
Promise.Some = Promise.some
Promise.Any = Promise.any
Promise.AllSettled = Promise.allSettled
Promise.Race = Promise.race
Promise.Each = Promise.each
Promise.Is = Promise.is
Promise.Promisify = Promise.promisify
Promise.Delay = Promise.delay
Promise.prototype.Timeout = Promise.prototype.timeout
Promise.prototype.GetStatus = Promise.prototype.getStatus
Promise.prototype.AndThen = Promise.prototype.andThen
Promise.prototype.Then = Promise.prototype.andThen
Promise.prototype.Catch = Promise.prototype.catch
Promise.prototype.Tap = Promise.prototype.tap
Promise.prototype.AndThenCall = Promise.prototype.andThenCall
Promise.prototype.ThenCall = Promise.prototype.andThenCall
Promise.prototype.AndThenReturn = Promise.prototype.andThenReturn
Promise.prototype.ThenReturn = Promise.prototype.andThenReturn
Promise.prototype.Cancel = Promise.prototype.cancel
Promise.prototype.Finally = Promise.prototype.finally
Promise.prototype.FinallyCall = Promise.prototype.finallyCall
Promise.prototype.FinallyReturn = Promise.prototype.finallyReturn
Promise.prototype.Done = Promise.prototype.done
Promise.prototype.DoneCall = Promise.prototype.doneCall
Promise.prototype.DoneReturn = Promise.prototype.doneReturn
Promise.prototype.AwaitStatus = Promise.prototype.awaitStatus
Promise.prototype.Await = Promise.prototype.await
Promise.prototype.Expect = Promise.prototype.expect
Promise.prototype.AwaitValue = Promise.prototype.expect
Promise.prototype.Now = Promise.prototype.now
Promise.Retry = Promise.retry
Promise.FromEvent = Promise.fromEvent

return Promise
--]]




function getHumanoid(model)
	for _, v in pairs(model:GetChildren()) do
		if v:IsA'Humanoid' then
			return v
		end
	end
end


local zombie = script.Parent
local human = getHumanoid(zombie)
local hroot = zombie.HumanoidRootPart
local zspeed = hroot.Velocity.magnitude


local pfs = game:GetService("PathfindingService")

function GetPlayerNames()
	local players = game:GetService('Players'):GetChildren()
	local name = nil
	for _, v in pairs(players) do
		if v:IsA'Player' then
			name = tostring(v.Name)
		end
	end
	return name
end

function GetPlayersBodyParts(t)
	local torso = t
	if torso then
		local figure = torso.Parent
		for _, v in pairs(figure:GetChildren()) do
			if v:IsA'Part' then
				return v.Name
			end
		end
	else
		return "HumanoidRootPart"
	end
end

function GetTorso(part)
	local chars = game.Workspace:GetChildren()
	local torso = nil
	for _, v in pairs(chars) do
		if v:IsA'Model' and v ~= script.Parent and v.Name == GetPlayerNames() then
			local charRoot = v:FindFirstChild'HumanoidRootPart'
			if (charRoot.Position - part).magnitude < SearchDistance then
				torso = charRoot
			end
		end
	end
	return torso
end

for _, zambieparts in pairs(zombie:GetChildren()) do
	if zambieparts:IsA'Part' then
		zambieparts.Touched:connect(function(p)
			if p.Parent.Name == GetPlayerNames() and p.Parent.Name ~= zombie.Name then -- damage
				local enemy = p.Parent
				local enemyhuman = getHumanoid(enemy)
				enemyhuman:TakeDamage(ZombieDamage)
			end
		end)
	end
end
--		print(animName .. " " .. idx .. " [" .. origRoll .. "]")


	local anim = animTable[animName][idx].anim

	-- switch animation		
	if (anim ~= currentAnimInstance) then
		
		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end

		currentAnimSpeed = 1.0
	
		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		 
		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName
		currentAnimInstance = anim

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
		
	end

end
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 150		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 1.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
--// All global vars will be wiped/replaced except script



return function(data, env)
	if env then
		setfenv(1, env)
	end

	local playergui = service.PlayerGui
	local localplayer = service.Players.LocalPlayer
	local gui = service.New("ScreenGui")
	local toggle = service.New("ImageButton", gui)
	local gTable = client.UI.Register(gui)

	if client.UI.Get("HelpButton", gui, true) then
		gui:Destroy()
		gTable:Destroy()
		return nil
	end

	gTable.Name = "HelpButton"
	gTable.CanKeepAlive = false

	toggle.Name = "Toggle"
	toggle.BackgroundTransparency = 1
	toggle.Position = UDim2.new(1, -45, 1, -45)
	toggle.Size = UDim2.new(0, 40, 0, 40)
	toggle.Image = "http://www.roblox.com/asset/?id=7059706594"
	toggle.ImageTransparency = 0

	--if client.UI.Get("Chat") then
	--	toggle.Position = UDim2.new(1, -(45+40),1, -45)
	--end

	toggle.MouseButton1Down:Connect(function()
		local found = client.UI.Get("UserPanel",nil,true)
		if found then
			found.Object:Destroy()
		else
			client.UI.Make("UserPanel",{})
		end
	end)

	gTable:Ready()
end
--Gauge


MakeWeld(car.Misc.Tach.M,car.DriveSeat,"Motor").Name="M"
ModelWeld(misc.Tach.Parts,misc.Tach.M)
MakeWeld(car.Misc.Speedo.N,car.DriveSeat,"Motor").Name="N"
ModelWeld(misc.Speedo.Parts,misc.Speedo.N)
-- Customization


	AntiTK = false; -- Set to false to allow TK and damaging of NPC, true for no TK. (To damage NPC, this needs to be false)
	
	MouseSense = 0.5;

	CanAim = true; -- Allows player to aim
	CanBolt = true; -- When shooting, if this is enabled, the bolt will move (SCAR-L, ACR, AK Series)
	
	LaserAttached = true;
	LightAttached = true;
	TracerEnabled = true;
	
	SprintSpeed = 25;
	
	CanCallout = false;
	SuppressCalloutChance = 0;
-- ключ значений у игрока в DataStore2


local DS2key = script.Parent.Parent.Name -- "MaxHeight1"

local clickDetector = script.Parent.ClickDetector
function onMouseClick(plr)
	-- для игрока plr, для ключа, изменить на 1
	module.Update(plr, DS2key, 1)
end
clickDetector.MouseClick:Connect(onMouseClick)
--		Open:Play()


		script.Parent.Handle.sound_open:Play()
		script.Parent.EffectsHolder.AttachOn.SparkParticles.Enabled = true
		script.Parent.EffectsHolder.AttachOn.SparkParticles.Enabled = false
		script.Parent.EffectsHolder.AttachOn.MainLight.Enabled = true
		script.Parent.EffectsHolder.AttachOn.SmallLight.Enabled = true
		script.Parent.EffectsHolder.AttachOn.SmallLight2.Enabled = true
		script.Parent.EffectsHolder.AttachOn.SmallLight3.Enabled = true
		script.Parent.EffectsHolder.AttachOn.FireParticles.Enabled = true
-- This will inject all types into this context.


local TypeDefs = require(script.Parent.TypeDefinitions)

type CanPierceFunction = TypeDefs.CanPierceFunction
type GenericTable = TypeDefs.GenericTable
type Caster = TypeDefs.Caster
type FastCastBehavior = TypeDefs.FastCastBehavior
type CastTrajectory = TypeDefs.CastTrajectory
type CastStateInfo = TypeDefs.CastStateInfo
type CastRayInfo = TypeDefs.CastRayInfo
type ActiveCast = TypeDefs.ActiveCast

local typeof = require(script.Parent.TypeMarshaller)
--



local Utils = require(utilsModule)

function Utils.GetAngleBetweenXZVectors(v1, v2)
	local upCFrame = lastUpCFrame -- this is kind of lame, but it works
	v1 = upCFrame:VectorToObjectSpace(v1)
	v2 = upCFrame:VectorToObjectSpace(v2)
	return math.atan2(v2.X*v1.Z-v2.Z*v1.X, v2.X*v1.X+v2.Z*v1.Z)
end
--[=[
	Adds the remote function mixin to a class

	```lua
	local BaseObject = require("BaseObject")

	local Bird = setmetatable({}, BaseObject)
	Bird.ClassName = "Bird"
	Bird.__index = Bird

	require("PromiseRemoteFunctionMixin"):Add(Bird, "BirdRemoteFunction")

	function Bird.new(inst)
		local self = setmetatable(BaseObject.new(inst), Bird)

		self:PromiseRemoteFunction():Then(function(remoteFunction)
			task.spawn(function()
				remoteFunction:InvokeServer() -- or whatever
			end)
		end)

		return self
	end
	```

	@param class { _maid: Maid }
	@param remoteFunctionName string
]=]


function PromiseRemoteFunctionMixin:Add(class, remoteFunctionName)
	assert(type(class) == "table", "Bad class")
	assert(type(remoteFunctionName) == "string", "Bad remoteFunctionName")
	assert(not class.PromiseRemoteFunctionMixin, "Class already has PromiseRemoteFunctionMixin defined")
	assert(not class._remoteFunctionName, "Class already has _remoteFunctionName defined")

	class.PromiseRemoteFunction = self.PromiseRemoteFunction
	class._remoteFunctionName = remoteFunctionName
end
-- To make this work, simply group it with the model you want!




local modelbackup = script.Parent.Parent:FindFirstChild(modelname):clone()
local trigger = script.Parent

enabled = true

function onTouched(hit)
	

	if enabled == true then

		enabled = false
		--trigger.BrickColor = BrickColor.new("Really black")

	if script.Parent.Parent:FindFirstChild(modelname) ~= nil then

		script.Parent.Parent:FindFirstChild(modelname):Destroy()


	end
wait(120)
		local modelclone = modelbackup:clone()
		modelclone.Parent = script.Parent.Parent
		modelclone:MakeJoints()

		wait(WaitTime)
		
		enabled = true
		--trigger.BrickColor = BrickColor.new("Bright violet")

	end

end
script.Parent.Touched:connect(onTouched)
--		print("Wha " .. pose)


		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end

	if (setAngles) then
		local desiredAngle = amplitude * math.sin(time * frequency)

		wait()
	end

	-- Tool Animation handling
	local tool = getTool()
	if tool and tool:FindFirstChild("Handle") then
	
		local animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = time + .3
		end

		if time > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()		
	else
		stopToolAnimations()
		toolAnim = "None"
		toolAnimInstance = nil
		toolAnimTime = 0
	end
end
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,VRecoil = {20,22}				--- Vertical Recoil
	,HRecoil = {8,10}				--- Horizontal Recoil
	,AimRecover = .3				---- Between 0 & 1
	
	,RecoilPunch = .35
	,VPunchBase = 5.75				--- Vertical Punch
	,HPunchBase = 3.25				--- Horizontal Punch
	,DPunchBase = 1 				--- Tilt Punch | useless
	
	,AimRecoilReduction = .75 		--- Recoil Reduction Factor While Aiming (Do not set to 0)
	,PunchRecover = 0.1
	,MinRecoilPower = 1
	,MaxRecoilPower = 1
	,RecoilPowerStepAmount = 1
	
	,MinSpread = 0.15				--- Min bullet spread value | Studs
	,MaxSpread = 25					--- Max bullet spread value | Studs
	,AimInaccuracyStepAmount = 0
	,WalkMultiplier = 0				--- Bullet spread based on player speed

	,SwayBase = 0.25				--- Weapon Base Sway | Studs
	,MaxSway =	3					--- Max sway value based on player stamina | Studs
-- Controls the glow of a firefly



local Configurations = script.Parent.Parent.Configuration -- Variables for configurations
local Brightness = Configurations.Brightness
local glowTime = Configurations.GlowTime
local notGlowTime = Configurations.NotGlowTime
local glowSpeed = Configurations.GlowSpeed
local glowRange = Configurations.GlowRange
local lightColor = Configurations.Color

local Fly = script.Parent

Fly.PointLight.Color = lightColor.Value -- Initialize light and collor settings
Fly.PointLight.Range = glowRange.Value
Fly.PointLight.Enabled = true

while true do
	Fly.BrickColor = BrickColor.new(lightColor.Value) -- Change color of the fly to make it properly visible when the light will glow
	for i = 1, Brightness.Value*10 do -- Slowly build strength of the light
		Fly.PointLight.Brightness = 0 + i*0.1
		Fly.Transparency = 0.5 - (0.5 * i)/(Brightness.Value*10)
		wait(1/(glowSpeed.Value*Brightness.Value*10))
	end
	wait(glowTime.Value+math.random(-10,10)*0.1) -- Wait for light to glow for some time
	for i = 1, Brightness.Value*10 do -- Slowly drop strength of the light
		Fly.PointLight.Brightness = Brightness.Value - i*0.1
		Fly.Transparency = (0.5 * i)/(Brightness.Value*10)
		wait(1/(glowSpeed.Value*Brightness.Value*10))
	end
	Fly.BrickColor = BrickColor.new("Really black") -- Make the fly dark, as it's dark without a light
	wait(notGlowTime.Value+math.random(-10,10)*0.1) -- Wait for light to be off for some time
end