local m=false local D,j function UUU()if script.Parent.Anim.Value==false then if m then return end if game.Workspace.Preparation.Value==true then return end if script.Parent.Enabled==false then return end D:Play()script.Parent.Anim.Value=true end end function THROW(G)if game.Workspace.Preparation.Value==true then return end if script.Parent.Enabled==false then return end if script.Parent.Anim.Value==true then if m then return end m=true D:Stop(0)if G and G==true then local m=Instance.new("\073\110\116\086\097\108\117\101")m.Parent=script.Parent m.Name="\083\104\111\114\116"end script.Parent.Anim.Value=false j:Play(0,1,1)script.Parent.Handle.Throw:Play()wait(.2)script.Parent.SpawnGrenade:FireServer(game.Players.LocalPlayer.Character.Head.CFrame,game.Players.LocalPlayer.Character.Humanoid.TargetPoint,G)end end repeat wait()until game.Players.LocalPlayer and game.Players.LocalPlayer.Character local G=(game.Players.LocalPlayer.Character:WaitForChild("\072\117\109\097\110\111\105\100")):LoadAnimation(script.Parent:WaitForChild("\073\100\108\101"))Tool.Equipped:connect(function(m)local b=false local p=false G:Play()Character=Tool.Parent Player=game.Players:GetPlayerFromCharacter(Character)local e=(WaitFor(Tool)).HoldAnim()e.AnimationId="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\056\056\055\052\051\053\057\050"local I=(WaitFor(Tool)).ThrowAnim()I.AnimationId="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\056\056\055\052\051\053\054\054"D=Character.Humanoid:LoadAnimation(e)j=Character.Humanoid:LoadAnimation(I)script.Parent.Enabled=false wait(.6)script.Parent.Enabled=true m.Button1Down:connect(function()b=true UUU()end)m.Button2Down:connect(function()p=true UUU()end)m.Button1Up:connect(function()b=false if b==false and p==false then THROW(false)end end)m.Button2Up:connect(function()p=false if b==false and p==false then THROW(true)end end)end)Tool.Unequipped:connect(function()script.Parent.Anim.Value=false if G then G:Stop()end script.Parent.Anim.Value=false if j then j:Stop()end if D then D:Stop()end end)
---------------------------------------------
local alreadythrown = false

local HoldAnim, ThrowAnim
function UUU()
	if script.Parent.Anim.Value == false then
		if alreadythrown then
			return
		end
		if game.Workspace.Preparation.Value == true then
			return
		end
		if script.Parent.Enabled == false then
			return
		end

		HoldAnim:Play()

		script.Parent.Anim.Value = true
	end
end

function THROW(short)
	if game.Workspace.Preparation.Value == true then
		return
	end
	if script.Parent.Enabled == false then
		return
	end
	if script.Parent.Anim.Value == true then
		if alreadythrown then
			return
		end
		alreadythrown = true
		--we track the reload time like this so that the player can't fire faster with
		--rapid dis / re-equipping, which will actually be common usage with this gear.
		HoldAnim:Stop(0)
		if short and short == true then
			local dent = Instance.new("IntValue")
			dent.Parent = script.Parent
			dent.Name = "Short"
		end
		script.Parent.Anim.Value = false

		ThrowAnim:Play(0, 1, 1)
		script.Parent.Handle.Throw:Play()
		wait(0.2)
		--
		script.Parent.SpawnGrenade:FireServer(
			game.Players.LocalPlayer.Character.Head.CFrame,
			game.Players.LocalPlayer.Character.Humanoid.TargetPoint,
			short
		)
	end
end
repeat
	wait()
until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local idle =
	game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent:WaitForChild("Idle"))
Tool.Equipped:connect(function(mouse)
	local button1 = false
	local button2 = false
	idle:Play()
	Character = Tool.Parent
	Player = game.Players:GetPlayerFromCharacter(Character)

	local HoldAnimSrc = WaitFor(Tool).HoldAnim()
	HoldAnimSrc.AnimationId = "http://www.roblox.com/asset/?id=88743592"
	local ThrowAnimSrc = WaitFor(Tool).ThrowAnim()
	ThrowAnimSrc.AnimationId = "http://www.roblox.com/asset/?id=88743566"

	HoldAnim = Character.Humanoid:LoadAnimation(HoldAnimSrc)
	ThrowAnim = Character.Humanoid:LoadAnimation(ThrowAnimSrc)
	script.Parent.Enabled = false
	wait(0.6)
	script.Parent.Enabled = true
	--setup first anim / cursor cycle
	mouse.Button1Down:connect(function()
		button1 = true
		UUU()
	end)
	mouse.Button2Down:connect(function()
		button2 = true
		UUU()
	end)
	mouse.Button1Up:connect(function()
		button1 = false
		if button1 == false and button2 == false then
			THROW(false)
		end
	end)
	mouse.Button2Up:connect(function()
		button2 = false
		if button1 == false and button2 == false then
			THROW(true)
		end
	end)
end)
Tool.Unequipped:connect(function()
	script.Parent.Anim.Value = false
	if idle then
		idle:Stop()
	end
	script.Parent.Anim.Value = false
	if ThrowAnim then
		ThrowAnim:Stop()
	end
	if HoldAnim then
		HoldAnim:Stop()
	end
end)
