------------------< variables >----------------
local uis = game:GetService("UserInputService")
local saber = script.Parent
local p = game.Players.LocalPlayer
local l = p.leaderstats
local equipped = false
local textBox = game.StarterGui.Strenght.TextLabel
local anim = script.Parent:WaitForChild("SwingAnimation")
------------------< code >---------------------
saber.Equipped:Connect(function()
equipped = true
end)
saber.Unequipped:Connect(function()
equipped = false
end)
uis.InputBegan:Connect(function(input1)
local mouseIn1 = input1.UserInputType
if equipped == true and mouseIn1 == Enum.UserInputType.MouseButton1 then
wait(0.6)
l.Strenght.Value = l.Strenght.Value + 5
local loadedAnim = p.Character.Humanoid:LoadAnimation(anim)
loadedAnim:Play()
end
end)
this is my script it works totally fine, but i want to know how to make the sword not give any strenght while the animation is playing any help is apriciated

2 comments
Could use an if statement to not run any damage code when the animation is playing. Think you could use this https://developer.roblox.com/en-us/api-reference/property/AnimationTrack/IsPlaying
ok so i did this "if anim.IsPlaying == true and mouseIn1 == Enum.UserInputType.MouseButton1 then wait(0.6) end" and it gives me an error