Sword still taking damage when not clicked

You’ll need to disconnect the touched event after it’s used (or use :Wait instead of :Connect), but I’d recommend using a bool instead of keep creating an event once a remote has been fired.

local Damage = false
local attackTime = 1

local TweenService = game:GetService("TweenService")
local Tweeninfo = TweenInfo.new(1.0)

script.Parent.Event.OnServerEvent:Connect(function(Player, Tool)
	local hit = Tool.Handle.Blade.Touched:Wait()			

	if hit.Parent:FindFirstChild("Humanoid") then 			
		local CloneOfVisualOne = game.ServerStorage.VisualOne:Clone()
		local TweenEnds = {
			Transparency = 1,
			Size = Vector3.new(11.2, 7.8, 11.2)
		}

		local Tween = TweenService:Create(CloneOfVisualOne, Tweeninfo, TweenEnds)
			
		if attackTime then return end isAttacking = not isAttacking 
		isAttacking = true
		local character = hit.Parent 
		CloneOfVisualOne.CFrame = character.HumanoidRootPart.CFrame
		CloneOfVisualOne.Parent = workspace
		Tween:Play()
		character.Humanoid:TakeDamage(1)
		wait(attackTime)
		attackTime = false
        CloneOfVisualOne:Destroy()			
	end
end)
2 Likes