this is my script
local Active = false
local HitNumber = 0
game.ReplicatedStorage:WaitForChild("LungeEvent").OnServerEvent:Connect(function (player)
Active = true
local lungeanim = Instance.new("Animation")
lungeanim.AnimationId=game:GetService("ReplicatedStorage"):WaitForChild("SwordConfiguration").Lunge.Value
local lungeanimtrack = player.Character.Humanoid:LoadAnimation(lungeanim)
lungeanimtrack:Play()
player.Character.Sword.Sword.Lunge:Play()
delay(.360,function()
local attachment0 = Instance.new("Attachment",player.Character.Sword.Sword)
attachment0.Position = Vector3.new(0.088, -0, -0.501)
local attachment1 = Instance.new("Attachment",player.Character.Sword.Sword)
attachment1.Position = Vector3.new(0.079, -0, 2.272)
local trail = player.Character.Sword.Sword.Trail
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
delay(1.2,function()
attachment0:Destroy()
attachment1:Destroy()
lungeanim:Destroy()
lungeanimtrack:Stop()
end)
end)
player.Character.Sword.Sword.Touched:Connect(function(toucher)
if toucher.Parent:FindFirstChild("Humanoid") ~= nil then
if game:GetService("ReplicatedStorage").HitVals:FindFirstChild("HitVal"..toucher.Parent.Name) == nil then
hitted = toucher.Parent
print(toucher.Parent.Name)
toucher.Parent.Humanoid:TakeDamage(game.ReplicatedStorage:WaitForChild("SwordConfiguration").Damage.Value)
local hitter = Instance.new("Folder",game:GetService("ReplicatedStorage").HitVals)
hitter.Name = "HitVal"..toucher.Parent.Name
end
end
end)
Active = false
for i,v in pairs(game:GetService("ReplicatedStorage").HitVals:GetChildren()) do
v:Destroy()
end
end)
