I've been making an attack for a while now but I still don't know how to get it to do any damage. I've worked through many scripts and I'm stuck here. Animation first script works perfectly second script no luck.

First

--Finds Player--
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer or game.Players.PlayerAdded:wait()
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local deb = false
local damagescript = game.ReplicatedStorage.ScriptOfDamage


--Finds Animations--
local Animation = Instance.new("Animation") 
Animation.AnimationId = "rbxassetid://2867339187" 
local AnimationR = Instance.new("Animation") 
AnimationR.AnimationId = "rbxassetid://2867339668"
local AnimationL = Instance.new("Animation") 
AnimationL.AnimationId = "rbxassetid://2867395453"
local Animations = {AnimationL,AnimationR}
local track = Humanoid:LoadAnimation(Animation)


--Just finding the Particles--
local particle = Character:WaitForChild("LeftUpperArm"):WaitForChild("ParticleEmitter") 
local particle1 = Character:WaitForChild("RightLowerArm"):WaitForChild("ParticleEmitter") 
local particle2 = Character:WaitForChild("RightUpperLeg"):WaitForChild("ParticleEmitter") 
local particle3 = Character:WaitForChild("UpperTorso"):WaitForChild("ParticleEmitter")
local particle4 = Character:WaitForChild("LowerTorso"):WaitForChild("ParticleEmitter")


--Funtion That Starts Animation and Enables the Particles--
UserInputService.InputBegan:Connect(function(input, proc)
	local track2 = Humanoid:LoadAnimation(Animations[math.random(#Animations)]) 
    if not proc and input.KeyCode == Enum.KeyCode.T then
	    if deb == true then return end
	    deb = true
	    local Damager = damagescript:Clone()
	    Damager.Parent = Character
        particle.Enabled = true 
        particle1.Enabled = true
        particle2.Enabled = true 
        particle3.Enabled = true
        particle4.Enabled = true
        track:Play() 
        wait(0.35) 
        track:Stop()
        track2:Play()  --Animaton Follows--
        wait(0.45)
        track2:Stop()
        particle.Enabled = false
        particle1.Enabled = false
        particle2.Enabled = false
        particle3.Enabled = false
        particle4.Enabled = false
        Damager:Destroy()
        deb = false
    end 
end)

Second

local LeftHand = script.Parent:FindFirstChild("LeftHand")
local RightHand = script.Parent:FindFirstChild("RightHand")
local deb = true

function Hit(hit)
	local human = hit.Parent:FindFirstChild("Humanoid")
	if deb == false then return end
	deb = false
	if human ~= nil and human ~= script.Parent.FindFirstChild("Humanoid")then
		human:TakeDamage(50)
		wait(0.3)
		deb = true
	end
end

RightHand.Touched:Connect(Hit)
LeftHand.Touched:Connect(Hit)

2 comments

0

Your deb = true is inside the if-then statement (second script), so after the first time it hits something other than a humanoid, it will never run

0

Ok I updated it and placed my wait(0.3) and deb = true after the first end at the bottom. Script is still broken though.