--Made By JakeDahJake


tool = script.Parent


local speedboost = 1.25
local damage = 100
local swingtime = 1


local handle = tool:WaitForChild("Handle")
local event = tool:WaitForChild("RemoteEvent")

local lastclick = tick()



handle.Touched:connect(function(hit)
	if equipped and character and humanoid and humanoid.Health > 0 and hit and not hit:isDescendantOf(character) then
		local targethumanoid = hit.Parent:FindFirstChild("Humanoid")
		if targethumanoid and targethumanoid.Health > 0 then
			hithumanoids{targethumanoid} = true
			targethumanoid:TakeDamage(damage)		
		end
	end
end)

tool.Activated:connect(function()
	local clickdelta = tick() - lastclick
	if clickdelta > swingtime then	
	    lastclick = tick()
		hithumanoid = {}
	end
end)


tool.Equipped:connect(function()
	equipped = true
	lastclick = tick()
	character = tool.Parent
	play = game.Players:GetPlayerFromCharacter(character)
	humanoid = character:FindFirstChild("Humanoid")
	if humanoid then
		humanoid.WalkSpeed = humanoid.WalkSpeed * speedboost
	else
		character = nil
	end
end)

tool.Unequipped:connect(function()
	equipped = false
	if humanoid then
		humanoid.WalkSpeed = humanoid.WalkSpeed / speedboost
	end
	character = nil
	humanoid = nil
end)

help?

1 comment

0

Please include any Output if you have any, for we can not simply look at the code, and figure out the problem instantly.