local o=nil char.ChildAdded:connect(function(V)if V:IsA("\084\111\111\108")and(Humanoid.Health>0 and(not ToolEquip and(V:FindFirstChild("\065\067\083\095\083\101\116\116\105\110\103\115")~=nil and((require(V.ACS_Settings)).Type=="\071\117\110"or(require(V.ACS_Settings)).Type=="\077\101\108\101\101"or(require(V.ACS_Settings)).Type=="\071\114\101\110\097\100\101"))))then local q=true if(char:WaitForChild("\072\117\109\097\110\111\105\100")).Sit and char.Humanoid.SeatPart:IsA("\086\101\104\105\099\108\101\083\101\097\116")or(char:WaitForChild("\072\117\109\097\110\111\105\100")).Sit and char.Humanoid.SeatPart:IsA("\086\101\104\105\099\108\101\083\101\097\116")then q=false end if q then o=V if not ToolEquip then setup(V)elseif ToolEquip then pcall(function()unset()setup(V)end)end end end end)char.ChildRemoved:connect(function(o)if o==WeaponTool then if ToolEquip then unset()end end end)Humanoid.Running:Connect(function(o)charspeed=o if o>.1 then running=true else running=false end end)Humanoid.Swimming:Connect(function(o)if Swimming then charspeed=o if o>.1 then running=true else running=false end end end)Humanoid.Died:Connect(function(o)(TS:Create(char.Humanoid,TweenInfo.new(1),{CameraOffset=Vector3.new(0,0,0)})):Play()ChangeStance=false Stand()Stances=0 Virar=0 CameraX=0 CameraY=0 Lean()Equipped=0 unset()Evt.NVG:Fire(false)end)Humanoid.Seated:Connect(function(o,V)if o and(V and V:IsA("\086\101\104\105\099\108\101\083\101\097\116"))then unset()Humanoid:UnequipTools()CanLean=false plr.CameraMaxZoomDistance=gameRules.VehicleMaxZoom else plr.CameraMaxZoomDistance=game.StarterPlayer.CameraMaxZoomDistance end if o then Sentado=true Stances=0 Virar=0 CameraX=0 CameraY=0 Stand()Lean()else Sentado=false CanLean=true end end)Humanoid.Changed:connect(function(o)if not gameRules.AntiBunnyHop then return end if o=="\074\117\109\112"and(Humanoid.Sit==true and Humanoid.SeatPart~=nil)then Humanoid.Sit=false elseif o=="\074\117\109\112"and Humanoid.Sit==false then if JumpDelay then Humanoid.Jump=false return false end JumpDelay=true delay(0,function()wait(gameRules.JumpCoolDown)JumpDelay=false end)end end)Humanoid.StateChanged:connect(function(o,V)if V==Enum.HumanoidStateType.Swimming then Swimming=true Stances=0 Virar=0 CameraX=0 CameraY=0 Stand()Lean()else Swimming=false end if gameRules.EnableFallDamage then if V==Enum.HumanoidStateType.Freefall and not falling then falling=true local o=0 local V=0 while falling do o=HumanoidRootPart.Velocity.magnitude V=V+1 Thread:Wait()end local q=(o-gameRules.MaxVelocity)*gameRules.DamageMult if q>5 and V>20 then local o=SKP_01 ..("-"..plr.UserId)cameraspring:accelerate(Vector3.new(-q/20,0,math.random(-q,q)/5))SwaySpring:accelerate(Vector3.new(math.random(-q,q)/5,q/5,0))local V=PastaFx.FallDamage:Clone()V.Parent=plr.PlayerGui V.Volume=q/Humanoid.MaxHealth V:Play()Debris:AddItem(V,V.TimeLength)Evt.Damage:InvokeServer(nil,nil,nil,nil,nil,nil,true,q,o)end elseif V==Enum.HumanoidStateType.Landed or V==Enum.HumanoidStateType.Dead then falling=false SwaySpring:accelerate(Vector3.new(0,2.5,0))end end end)mouse.WheelBackward:Connect(function()if ToolEquip and(not CheckingMag and(not aimming and(not reloading and(not runKeyDown and(AnimDebounce and WeaponData.Type=="\071\117\110")))))then mouse1down=false if GunStance==0 then SafeMode=true GunStance=-1 UpdateGui()Evt.GunStance:FireServer(GunStance,AnimData)LowReady()elseif GunStance==-1 then SafeMode=true GunStance=-2 UpdateGui()Evt.GunStance:FireServer(GunStance,AnimData)Patrol()elseif GunStance==1 then SafeMode=false GunStance=0 UpdateGui()Evt.GunStance:FireServer(GunStance,AnimData)IdleAnim()end end if ToolEquip and(aimming and Sens>5)then Sens=Sens-5 UpdateGui();(game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")).MouseDeltaSensitivity=Sens/100 end end)mouse.WheelForward:Connect(function()if ToolEquip and(not CheckingMag and(not aimming and(not reloading and(not runKeyDown and(AnimDebounce and WeaponData.Type=="\071\117\110")))))then mouse1down=false if GunStance==0 then SafeMode=true GunStance=1 UpdateGui()Evt.GunStance:FireServer(GunStance,AnimData)HighReady()elseif GunStance==-1 then SafeMode=false GunStance=0 UpdateGui()Evt.GunStance:FireServer(GunStance,AnimData)IdleAnim()elseif GunStance==-2 then SafeMode=true GunStance=-1 UpdateGui()Evt.GunStance:FireServer(GunStance,AnimData)LowReady()end end if ToolEquip and(aimming and Sens<100)then Sens=Sens+5 UpdateGui();(game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")).MouseDeltaSensitivity=Sens/100 end end);(script.Parent:GetAttributeChangedSignal("\073\110\106\117\114\101\100")):Connect(function()local o=script.Parent:GetAttribute("\073\110\106\117\114\101\100")if o and runKeyDown then runKeyDown=false Stand()if not CheckingMag and(not reloading and(WeaponData and(WeaponData.Type~="\071\114\101\110\097\100\101"and(GunStance==0 or GunStance==2 or GunStance==3))))then GunStance=0 Evt.GunStance:FireServer(GunStance,AnimData)IdleAnim()end end if Stances==0 then Stand()elseif Stances==1 then Crouch()end end)
----------//Gun System\\----------
local L_199_ = nil
char.ChildAdded:connect(function(Tool)
	if
		Tool:IsA("Tool")
		and Humanoid.Health > 0
		and not ToolEquip
		and Tool:FindFirstChild("ACS_Settings") ~= nil
		and (
			require(Tool.ACS_Settings).Type == "Gun"
			or require(Tool.ACS_Settings).Type == "Melee"
			or require(Tool.ACS_Settings).Type == "Grenade"
		)
	then
		local L_370_ = true
		if
			char:WaitForChild("Humanoid").Sit and char.Humanoid.SeatPart:IsA("VehicleSeat")
			or char:WaitForChild("Humanoid").Sit and char.Humanoid.SeatPart:IsA("VehicleSeat")
		then
			L_370_ = false
		end

		if L_370_ then
			L_199_ = Tool
			if not ToolEquip then
				--pcall(function()
				setup(Tool)
				--end)
			elseif ToolEquip then
				pcall(function()
					unset()
					setup(Tool)
				end)
			end
		end
	end
end)

char.ChildRemoved:connect(function(Tool)
	if Tool == WeaponTool then
		if ToolEquip then
			unset()
		end
	end
end)

Humanoid.Running:Connect(function(speed)
	charspeed = speed
	if speed > 0.1 then
		running = true
	else
		running = false
	end
end)

Humanoid.Swimming:Connect(function(speed)
	if Swimming then
		charspeed = speed
		if speed > 0.1 then
			running = true
		else
			running = false
		end
	end
end)

Humanoid.Died:Connect(function(speed)
	TS:Create(char.Humanoid, TweenInfo.new(1), { CameraOffset = Vector3.new(0, 0, 0) }):Play()
	ChangeStance = false
	Stand()
	Stances = 0
	Virar = 0
	CameraX = 0
	CameraY = 0
	Lean()
	Equipped = 0
	unset()
	Evt.NVG:Fire(false)
end)

Humanoid.Seated:Connect(function(IsSeated, Seat)
	if IsSeated and Seat and (Seat:IsA("VehicleSeat")) then
		unset()
		Humanoid:UnequipTools()
		CanLean = false
		plr.CameraMaxZoomDistance = gameRules.VehicleMaxZoom
	else
		plr.CameraMaxZoomDistance = game.StarterPlayer.CameraMaxZoomDistance
	end

	if IsSeated then
		Sentado = true
		Stances = 0
		Virar = 0
		CameraX = 0
		CameraY = 0
		Stand()
		Lean()
	else
		Sentado = false
		CanLean = true
	end
end)

Humanoid.Changed:connect(function(Property)
	if not gameRules.AntiBunnyHop then
		return
	end
	if Property == "Jump" and Humanoid.Sit == true and Humanoid.SeatPart ~= nil then
		Humanoid.Sit = false
	elseif Property == "Jump" and Humanoid.Sit == false then
		if JumpDelay then
			Humanoid.Jump = false
			return false
		end
		JumpDelay = true
		delay(0, function()
			wait(gameRules.JumpCoolDown)
			JumpDelay = false
		end)
	end
end)

Humanoid.StateChanged:connect(function(Old, state)
	if state == Enum.HumanoidStateType.Swimming then
		Swimming = true
		Stances = 0
		Virar = 0
		CameraX = 0
		CameraY = 0
		Stand()
		Lean()
	else
		Swimming = false
	end

	if gameRules.EnableFallDamage then
		if state == Enum.HumanoidStateType.Freefall and not falling then
			falling = true
			local curVel = 0
			local peak = 0

			while falling do
				curVel = HumanoidRootPart.Velocity.magnitude
				peak = peak + 1
				Thread:Wait()
			end
			local damage = (curVel - gameRules.MaxVelocity) * gameRules.DamageMult
			if damage > 5 and peak > 20 then
				local SKP_02 = SKP_01 .. "-" .. plr.UserId

				cameraspring:accelerate(Vector3.new(-damage / 20, 0, math.random(-damage, damage) / 5))
				SwaySpring:accelerate(Vector3.new(math.random(-damage, damage) / 5, damage / 5, 0))

				local hurtSound = PastaFx.FallDamage:Clone()
				hurtSound.Parent = plr.PlayerGui
				hurtSound.Volume = damage / Humanoid.MaxHealth
				hurtSound:Play()
				Debris:AddItem(hurtSound, hurtSound.TimeLength)

				Evt.Damage:InvokeServer(nil, nil, nil, nil, nil, nil, true, damage, SKP_02)
			end
		elseif state == Enum.HumanoidStateType.Landed or state == Enum.HumanoidStateType.Dead then
			falling = false
			SwaySpring:accelerate(Vector3.new(0, 2.5, 0))
		end
	end
end)

mouse.WheelBackward:Connect(function() -- fires when the wheel goes forwards
	if
		ToolEquip
		and not CheckingMag
		and not aimming
		and not reloading
		and not runKeyDown
		and AnimDebounce
		and WeaponData.Type == "Gun"
	then
		mouse1down = false
		if GunStance == 0 then
			SafeMode = true
			GunStance = -1
			UpdateGui()
			Evt.GunStance:FireServer(GunStance, AnimData)
			LowReady()
		elseif GunStance == -1 then
			SafeMode = true
			GunStance = -2
			UpdateGui()
			Evt.GunStance:FireServer(GunStance, AnimData)
			Patrol()
		elseif GunStance == 1 then
			SafeMode = false
			GunStance = 0
			UpdateGui()
			Evt.GunStance:FireServer(GunStance, AnimData)
			IdleAnim()
		end
	end

	if ToolEquip and aimming and Sens > 5 then
		Sens = Sens - 5
		UpdateGui()
		game:GetService("UserInputService").MouseDeltaSensitivity = (Sens / 100)
	end
end)

mouse.WheelForward:Connect(function() -- fires when the wheel goes backwards
	if
		ToolEquip
		and not CheckingMag
		and not aimming
		and not reloading
		and not runKeyDown
		and AnimDebounce
		and WeaponData.Type == "Gun"
	then
		mouse1down = false
		if GunStance == 0 then
			SafeMode = true
			GunStance = 1
			UpdateGui()
			Evt.GunStance:FireServer(GunStance, AnimData)
			HighReady()
		elseif GunStance == -1 then
			SafeMode = false
			GunStance = 0
			UpdateGui()
			Evt.GunStance:FireServer(GunStance, AnimData)
			IdleAnim()
		elseif GunStance == -2 then
			SafeMode = true
			GunStance = -1
			UpdateGui()
			Evt.GunStance:FireServer(GunStance, AnimData)
			LowReady()
		end
	end

	if ToolEquip and aimming and Sens < 100 then
		Sens = Sens + 5
		UpdateGui()
		game:GetService("UserInputService").MouseDeltaSensitivity = (Sens / 100)
	end
end)

script.Parent:GetAttributeChangedSignal("Injured"):Connect(function()
	local valor = script.Parent:GetAttribute("Injured")

	if valor and runKeyDown then
		runKeyDown = false
		Stand()
		if
			not CheckingMag
			and not reloading
			and WeaponData
			and WeaponData.Type ~= "Grenade"
			and (GunStance == 0 or GunStance == 2 or GunStance == 3)
		then
			GunStance = 0
			Evt.GunStance:FireServer(GunStance, AnimData)
			IdleAnim()
		end
	end

	if Stances == 0 then
		Stand()
	elseif Stances == 1 then
		Crouch()
	end
end)
