------------------< 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
Try to switch like that
local loadedAnim = p.Character.Humanoid:LoadAnimation(anim) loadedAnim:Play() wait(2) l.Strenght.Value = l.Strenght.Value + 5
edit:
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") local hitt = 1 ------------------< 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 if hitt == 1 then l.Strenght.Value = l.Strenght.Value + 5 local loadedAnim = p.Character.Humanoid:LoadAnimation(anim) loadedAnim:Play() hitt = 0 wait(1) hitt = 1 end end end)