sp=script.Parent damage=22 damagewindow=1 swingrate=.75 clashsounds={91154405;91154446;91154471,91154503;91154521}swooshsounds={91154708;91155889}hitsounds={91154909;91154932;91154954}anims={"\083\116\097\098\049";"\083\116\097\098\050","\082\105\103\104\116\083\108\097\115\104","\076\101\102\116\083\108\097\115\104"}bloodeffects=false ready=false equipped=false rate=.033333333333333 lastswing=0 local o=sp:WaitForChild("\082\101\108\111\097\100\105\110\103")local M=sp:WaitForChild("\077\111\117\115\101\068\111\119\110")local U=sp:WaitForChild("\082\117\110\065\110\105\109")local k=sp.Handle:WaitForChild("\083\112\097\114\107\108\101\115")local v=game:getService("\068\101\098\114\105\115")local q=sp:WaitForChild("\087\101\097\112\111\110\072\117\100")local m=q:WaitForChild("\087\101\097\112\111\110\078\097\109\101")local A=q:WaitForChild("\066\097\114")local l=A:WaitForChild("\070\105\108\108")m.Text=sp.Name function runsound(o,M)local U=M or 1 local k=Instance.new("\083\111\117\110\100")k.Looped=false k.Pitch=1 k.SoundId="\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"..tostring(o)k.PlayOnRemove=false k.Volume=U v:AddItem(k,3)k.Parent=sp.Handle wait()k:Play()end function billboard(o,M,U,k)local q=o or Vector3.new(0,0,0)local m=M or"\072\101\108\108\111 \087\111\114\108\100\033"local A=U or 2 local l=k or Color3.new(1,0,0)local W=q+Vector3.new(0,5,0)local N=Instance.new("\080\097\114\116")N.Name="\069\102\102\101\099\116"N.formFactor="\067\117\115\116\111\109"N.Size=Vector3.new(0,0,0)N.TopSurface="\083\109\111\111\116\104"N.BottomSurface="\083\109\111\111\116\104"N.CFrame=CFrame.new(W)N.Anchored=true N.CanCollide=false N.Transparency=1 local S=Instance.new("\066\105\108\108\098\111\097\114\100\071\117\105")S.Size=UDim2.new(3,0,3,0)S.Adornee=N local J=Instance.new("\084\101\120\116\076\097\098\101\108")J.BackgroundTransparency=1 J.Size=UDim2.new(1,0,1,0)J.Text=m J.TextColor3=l J.TextScaled=true J.Font="\065\114\105\097\108\066\111\108\100"J.Parent=S S.Parent=N v:AddItem(N,A+.1)N.Parent=game.Workspace delay(0,function()local o=A/rate for M=1,o,1 do wait(rate)local U=M/o N.CFrame=CFrame.new(W)+Vector3.new(0,5*U,0)J.TextTransparency=U end N:remove()end)end function makeblood(o)if o then local M=Instance.new("\080\097\114\116")M.BrickColor=BrickColor.new("\066\114\105\103\104\116 \114\101\100")M.formFactor="\067\117\115\116\111\109"M.Transparency=math.random(0,1)*.5 if math.random()<.5 then M.CanCollide=false else M.CanCollide=true end M.TopSurface="\083\109\111\111\116\104"M.BottomSurface="\083\109\111\111\116\104"M.Size=Vector3.new(.2*math.random(1,5),.2*math.random(1,5),.2*math.random(1,5))M.Velocity=o.Velocity+Vector3.new(math.random()-.5,math.random()-.5,math.random()-.5)*30 M.RotVelocity=o.RotVelocity+Vector3.new(math.random()-.5,math.random()-.5,math.random()-.5)*20 M.CFrame=(o.CFrame*CFrame.new((math.random()-.5)*3,(math.random()-.5)*3,(math.random()-.5)*3))*CFrame.Angles((math.pi*2)*math.random(),(math.pi*2)*math.random(),(math.pi*2)*math.random())v:AddItem(M,math.random()*4)M.Parent=game.Workspace end end sp.Handle.Touched:connect(function(o)if ready and(equipped and(o and(o.Parent~=nil and(o:IsDescendantOf(sp.Parent)==false and(string.lower(string.sub(o.Name,1,6))~="\101\102\102\101\099\116"and tick()-lastswing<=damagewindow)))))then if o:FindFirstChild("\067\097\110\066\108\111\099\107")and sp.Handle:FindFirstChild("\066\108\111\099\107\097\098\108\101")then ready=false runsound(clashsounds[math.random(1,#clashsounds)])k.Enabled=true delay(.2,function()k.Enabled=false end)billboard(sp.Handle.Position,"\066\108\111\099\107",2,Color3.new(1,1,0))end local M=sp.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")local U=o.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")local q=sp.Parent:FindFirstChild("\082\105\103\104\116 \065\114\109")local m=game.Players:GetPlayerFromCharacter(sp.Parent)if M and(U and(U~=M and(M.Health>0 and(U.Health>0 and(q and m~=nil)))))then local M=game.Players:GetPlayerFromCharacter(U.Parent)if M~=nil and(not M.Neutral and(not m.Neutral and M.TeamColor==m.TeamColor))then return end ready=false for o,M in ipairs(U:GetChildren())do if M.Name=="\099\114\101\097\116\111\114"then M:remove()end end local k=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")k.Name="\099\114\101\097\116\111\114"k.Value=m k.Parent=U v:AddItem(k,1)local q=math.floor(damage*(.9+math.random()*.2)+.5)U:TakeDamage(q)billboard(o.Position,"-"..tostring(q))runsound(hitsounds[math.random(1,#hitsounds)])if bloodeffects then local M=math.ceil(q/10)for M=1,math.random(M-1,M+1),1 do makeblood(o)end end end end end)function Activate()if equipped and tick()-lastswing>=swingrate then ready=true o.Value=true runsound(swooshsounds[math.random(1,#swooshsounds)],.5)newanim=anims[math.random(1,#anims)]while newanim==U.Value do newanim=anims[math.random(1,#anims)]end U.Value=newanim lastswing=tick()wait(swingrate)o.Value=false if M.Value then Activate()end end end M.Changed:connect(function()if M.Value then Activate()end end)sp.Equipped:connect(function(U)lastswing=tick()o.Value=true ready=false equipped=true local k=game.Players:GetPlayerFromCharacter(sp.Parent)if k~=nil then local o=k:FindFirstChild("\080\108\097\121\101\114\071\117\105")if o~=nil then q.Parent=o end end wait(swingrate)o.Value=false if M.Value then Activate()end end)sp.Unequipped:connect(function()ready=false equipped=false q.Parent=sp end)function updategui()local o=math.min((tick()-lastswing)/swingrate,1)if o<.5 then l.BackgroundColor3=Color3.new(1,o*2,0)else l.BackgroundColor3=Color3.new(1-(o-.5)/.5,1,0)end l.Size=UDim2.new(o,0,1,0)end while true do updategui()wait(rate)end
--Made by Stickmasterluke

sp = script.Parent

damage = 22 --  +/- 10%
damagewindow = 1 --after clicking, how long does the player have to hit the opponent wioth their weapon to deal damage
swingrate = 0.75

clashsounds = { 91154405, 91154446, 91154471, 91154503, 91154521 }
swooshsounds = { 91154708, 91155889 }
hitsounds = { 91154909, 91154932, 91154954 }
anims = { "Stab1", "Stab2", "RightSlash", "LeftSlash" }
bloodeffects = false

ready = false
equipped = false
rate = 1 / 30
lastswing = 0

local reloading = sp:WaitForChild("Reloading")
local down = sp:WaitForChild("MouseDown")
local runanim = sp:WaitForChild("RunAnim")
local sparkles = sp.Handle:WaitForChild("Sparkles")
local debris = game:getService("Debris")
local weaponhud = sp:WaitForChild("WeaponHud")
local weaponnametag = weaponhud:WaitForChild("WeaponName")
local guibar = weaponhud:WaitForChild("Bar")
local guibarfill = guibar:WaitForChild("Fill")
weaponnametag.Text = sp.Name

function runsound(id, volume)
	local volume = volume or 1
	local sound = Instance.new("Sound")
	sound.Looped = false
	sound.Pitch = 1
	sound.SoundId = "http://www.roblox.com/asset/?id=" .. tostring(id)
	sound.PlayOnRemove = false
	sound.Volume = volume
	debris:AddItem(sound, 3)
	sound.Parent = sp.Handle
	wait()
	sound:Play()
end

function billboard(pos, text, time, color)
	local pos = pos or Vector3.new(0, 0, 0)
	local text = text or "Hello World!"
	local time = time or 2
	local color = color or Color3.new(1, 0, 0)
	local pos = pos + Vector3.new(0, 5, 0)
	local ep = Instance.new("Part")
	ep.Name = "Effect"
	ep.formFactor = "Custom"
	ep.Size = Vector3.new(0, 0, 0)
	ep.TopSurface = "Smooth"
	ep.BottomSurface = "Smooth"
	ep.CFrame = CFrame.new(pos)
	ep.Anchored = true
	ep.CanCollide = false
	ep.Transparency = 1
	local bb = Instance.new("BillboardGui")
	bb.Size = UDim2.new(3, 0, 3, 0)
	bb.Adornee = ep
	local tl = Instance.new("TextLabel")
	tl.BackgroundTransparency = 1
	tl.Size = UDim2.new(1, 0, 1, 0)
	tl.Text = text
	tl.TextColor3 = color
	tl.TextScaled = true
	tl.Font = "ArialBold"

	tl.Parent = bb
	bb.Parent = ep
	debris:AddItem(ep, time + 0.1)
	ep.Parent = game.Workspace
	delay(0, function()
		local frames = time / rate
		for frame = 1, frames do
			wait(rate)
			local percent = frame / frames
			ep.CFrame = CFrame.new(pos) + Vector3.new(0, 5 * percent, 0)
			tl.TextTransparency = percent
		end
		ep:remove()
	end)
end

function makeblood(part)
	if part then
		local b = Instance.new("Part")
		b.BrickColor = BrickColor.new("Bright red")
		b.formFactor = "Custom"
		b.Transparency = math.random(0, 1) * 0.5
		if math.random() < 0.5 then
			b.CanCollide = false
		else
			b.CanCollide = true
		end
		b.TopSurface = "Smooth"
		b.BottomSurface = "Smooth"
		b.Size = Vector3.new(0.2 * math.random(1, 5), 0.2 * math.random(1, 5), 0.2 * math.random(1, 5))
		b.Velocity = part.Velocity + (
				Vector3.new((math.random() - 0.5), (math.random() - 0.5), (math.random() - 0.5)) * 30
			)
		b.RotVelocity = part.RotVelocity
			+ (Vector3.new((math.random() - 0.5), (math.random() - 0.5), (math.random() - 0.5)) * 20)
		b.CFrame = part.CFrame
			* CFrame.new((math.random() - 0.5) * 3, (math.random() - 0.5) * 3, (math.random() - 0.5) * 3)
			* CFrame.Angles(math.pi * 2 * math.random(), math.pi * 2 * math.random(), math.pi * 2 * math.random())
		debris:AddItem(b, math.random() * 4)
		b.Parent = game.Workspace
	end
end

sp.Handle.Touched:connect(function(hit)
	if
		ready
		and equipped
		and hit
		and hit.Parent ~= nil
		and hit:IsDescendantOf(sp.Parent) == false
		and string.lower(string.sub(hit.Name, 1, 6)) ~= "effect"
		and (tick() - lastswing) <= damagewindow
	then
		if hit:FindFirstChild("CanBlock") and sp.Handle:FindFirstChild("Blockable") then
			ready = false
			runsound(clashsounds[math.random(1, #clashsounds)])
			sparkles.Enabled = true
			delay(0.2, function()
				sparkles.Enabled = false
			end)
			billboard(sp.Handle.Position, "Block", 2, Color3.new(1, 1, 0))
		end
		local mh = sp.Parent:FindFirstChild("Humanoid")
		local eh = hit.Parent:FindFirstChild("Humanoid")
		local ra = sp.Parent:FindFirstChild("Right Arm")
		local plr = game.Players:GetPlayerFromCharacter(sp.Parent)
		if mh and eh and eh ~= mh and mh.Health > 0 and eh.Health > 0 and ra and plr ~= nil then
			local eplr = game.Players:GetPlayerFromCharacter(eh.Parent)
			if eplr ~= nil and not eplr.Neutral and not plr.Neutral and eplr.TeamColor == plr.TeamColor then
				return --No team killing
			end
			ready = false
			for i, v in ipairs(eh:GetChildren()) do
				if v.Name == "creator" then
					v:remove()
				end
			end
			local creator = Instance.new("ObjectValue")
			creator.Name = "creator"
			creator.Value = plr
			creator.Parent = eh
			debris:AddItem(creator, 1)
			local localdamage = math.floor(damage * (0.9 + (math.random() * 0.2)) + 0.5)
			eh:TakeDamage(localdamage)
			billboard(hit.Position, "-" .. tostring(localdamage))
			runsound(hitsounds[math.random(1, #hitsounds)])
			if bloodeffects then
				local numbloodeffects = math.ceil(localdamage / 10)
				for i = 1, math.random(numbloodeffects - 1, numbloodeffects + 1) do
					--[[if math.random()<.5 then
						makeblood(sp.Handle)
					else]]
					makeblood(hit)
					--end
				end
			end
		end
	end
end)

function Activate()
	if equipped and (tick() - lastswing) >= swingrate then
		ready = true
		reloading.Value = true

		runsound(swooshsounds[math.random(1, #swooshsounds)], 0.5)

		newanim = anims[math.random(1, #anims)]
		while newanim == runanim.Value do
			newanim = anims[math.random(1, #anims)]
		end
		runanim.Value = newanim

		lastswing = tick()

		wait(swingrate)

		reloading.Value = false
		if down.Value then
			Activate()
		end
	end
end

down.Changed:connect(function()
	if down.Value then
		Activate()
	end
end)

sp.Equipped:connect(function(mouse)
	lastswing = tick()

	reloading.Value = true
	ready = false
	equipped = true
	local plr = game.Players:GetPlayerFromCharacter(sp.Parent)
	if plr ~= nil then
		local plrgui = plr:FindFirstChild("PlayerGui")
		if plrgui ~= nil then
			weaponhud.Parent = plrgui
		end
	end

	wait(swingrate)

	reloading.Value = false
	if down.Value then
		Activate()
	end
end)

sp.Unequipped:connect(function()
	ready = false
	equipped = false
	weaponhud.Parent = sp
end)

function updategui()
	local swingpercent = math.min((tick() - lastswing) / swingrate, 1)
	if swingpercent < 0.5 then --fade from red to yellow then to green
		guibarfill.BackgroundColor3 = Color3.new(1, swingpercent * 2, 0)
	else
		guibarfill.BackgroundColor3 = Color3.new(1 - ((swingpercent - 0.5) / 0.5), 1, 0)
	end
	guibarfill.Size = UDim2.new(swingpercent, 0, 1, 0)
end
while true do
	updategui()
	wait(rate)
end
