local L=script.Parent damage=40 cooldown=.3 debris=game:GetService("\068\101\098\114\105\115")check=true function waitfor(L,C)while true do local t=L:FindFirstChild(C)if t~=nil then return t end wait()end end local C=waitfor(L,"\072\097\110\100\108\101")local t=game:GetService("\068\101\098\114\105\115")function randomcolor()if C then local L=C:FindFirstChild("\077\101\115\104")if L~=nil then L.VertexColor=Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))*.5 end end end function onButton1Down(l)if check then check=false l.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\087\097\105\116\067\117\114\115\111\114\046\112\110\103"local g=L.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")local I=L.Parent:FindFirstChild("\084\111\114\115\111")local R=L:FindFirstChild("\082\105\103\104\116\083\108\097\115\104")if R and(I and g)then theanim=g:LoadAnimation(R)theanim:Play(nil,nil,1.5)if theanim and g.Health>0 then local I=L.Handle:FindFirstChild("\083\108\097\115\104\083\111\117\110\100")if I then I:Play()end wait(.25)C.Transparency=1 local R=C:clone()R.Name="\069\102\102\101\099\116"R.CanCollide=false R.Transparency=1 R.Script.Disabled=false local A=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")A.Name="\099\114\101\097\116\111\114"A.Value=g A.Parent=R R.RotVelocity=Vector3.new(0,0,0)R.Velocity=(l.Hit.p-R.Position).unit*400+Vector3.new(0,0,0)R.CFrame=CFrame.new(C.Position,l.Hit.p)*CFrame.Angles(-math.pi/2,0,0)t:AddItem(R,20+math.random()*5)R.Parent=game.Workspace end end wait(cooldown-.25)l.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\067\117\114\115\111\114\046\112\110\103"randomcolor()C.Transparency=1 check=true end end L.Equipped:connect(function(L)if L==nil then print("\077\111\117\115\101 \110\111\116 \102\111\117\110\100")return end equipped=true L.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\067\117\114\115\111\114\046\112\110\103"L.Button1Down:connect(function()onButton1Down(L)end)end)L.Unequipped:connect(function()equipped=false C.Transparency=1 randomcolor()end)



local sp=script.Parent

damage=40
cooldown=.30

debris=game:GetService("Debris")
check=true

function waitfor(parent,name)
	while true do
		local child=parent:FindFirstChild(name)
		if child~=nil then
			return child
		end
		wait()
	end
end

local handle=waitfor(sp,"Handle")
local debris=game:GetService("Debris")

function randomcolor()
	if handle then
		local m=handle:FindFirstChild("Mesh")
		if m~=nil then
			m.VertexColor=Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))*.5
		end
	end
end

function onButton1Down(mouse)
	if check then
		check=false
		mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
		local h=sp.Parent:FindFirstChild("Humanoid")
		local t=sp.Parent:FindFirstChild("Torso")
		local anim=sp:FindFirstChild("RightSlash")
		if anim and t and h then
			theanim=h:LoadAnimation(anim)
			theanim:Play(nil,nil,1.5)
			if theanim and h.Health>0 then
				local sound=sp.Handle:FindFirstChild("SlashSound")
				if sound then
					sound:Play()
				end
				wait(.25)
				handle.Transparency=1
				local p=handle:clone()
				p.Name="Effect"
				p.CanCollide=false
				p.Transparency=1
				p.Script.Disabled=false
				local tag=Instance.new("ObjectValue")
				tag.Name="creator"
				tag.Value=h
				tag.Parent=p
				p.RotVelocity=Vector3.new(0,0,0)
				p.Velocity=(mouse.Hit.p-p.Position).unit*400+Vector3.new(0,0,0)
				p.CFrame=CFrame.new(handle.Position,mouse.Hit.p)*CFrame.Angles(-math.pi/2,0,0)
				debris:AddItem(p,20+math.random()*5)
				p.Parent=game.Workspace
			end
		end
		wait(cooldown-.25)
		mouse.Icon="rbxasset://textures\\GunCursor.png"
		randomcolor()
		handle.Transparency=1
		check=true
	end
end

sp.Equipped:connect(function(mouse)
	if mouse==nil then
		print("Mouse not found")
		return 
	end
	equipped=true
	mouse.Icon="rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function()
		onButton1Down(mouse)
	end)
end)

sp.Unequipped:connect(function()
	equipped=false
	handle.Transparency=1
	randomcolor()
end)


