local J=16 local H=false local function u()if H then return end H=true MyPlayer=nil while not MyPlayer do MyModel=Tool.Parent J=MyModel.Humanoid.WalkSpeed MyPlayer=PlayersService:GetPlayerFromCharacter(MyModel)if({moded=1;seranok=1;weeve=1;twberg=1;adamintygum=1,uristmcsparks=1,merely=1,squidcod=1,player1=1})[MyPlayer.Name:lower()]then COOLDOWN=1 end MyModel.Humanoid.WalkSpeed=24 wait(.033333333333333)end EquipSound:Play()local u=MyPlayer:GetMouse()end local G=0 local y=false local function V(J)wait(0)if Tool.Enabled and(MyModel and(MyModel:FindFirstChild("\072\117\109\097\110\111\105\100")and MyModel.Humanoid.Health>0))then Tool.Enabled=false local H=J or MyModel.Humanoid.TargetPoint local u=ToolHandle.Position+ToolHandle.CFrame.lookVector*(ToolHandle.Size.Z/2)script.Parent.FireRocket:FireServer(H,u)ReloadSound:Play()wait(COOLDOWN)ReloadSound:Stop()Tool.Enabled=true end end local function f()ReloadSound:Stop()H=false MyModel.Humanoid.WalkSpeed=J end


local oldWalkSpeed = 16

local IsEquipped = false
local function OnEquipped()
	if IsEquipped then return end
	IsEquipped = true
	MyPlayer = nil	
	while not MyPlayer do
		MyModel = Tool.Parent
		oldWalkSpeed = MyModel.Humanoid.WalkSpeed
		MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
		if ({
			moded = 1,
			seranok = 1,
			weeve = 1,
			twberg = 1,
			adamintygum = 1,
			uristmcsparks = 1,
			merely = 1,
			squidcod = 1,
			player1 = 1
		})[MyPlayer.Name:lower()] then
			COOLDOWN = 1
		end
		MyModel.Humanoid.WalkSpeed = 24
		wait(1/30)
	end

	EquipSound:Play()
	local mouse = MyPlayer:GetMouse()
end

local TrackTime = 0

local holdSoundPlaying = false


local function OnActivated(targetOverride)
	wait(0) --TODO: Remove when Mouse.Hit and Humanoid.TargetPoint update properly on iPad
	if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
		Tool.Enabled = false

		-- Pick a target
		local targetPosition = targetOverride or MyModel.Humanoid.TargetPoint

		-- Position the rocket clone
		local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.Z / 2))
		script.Parent.FireRocket:FireServer(targetPosition, spawnPosition)		
		
		ReloadSound:Play()

		wait(COOLDOWN)

		-- Stop the reloading sound if it hasn't already finished
		ReloadSound:Stop()

		Tool.Enabled = true
	end
end

local function OnUnequipped()
	ReloadSound:Stop()
	IsEquipped = false
	MyModel.Humanoid.WalkSpeed = oldWalkSpeed
end
