It doesn't stop I dont have a script I want a script to stop it there is a screen shot of my Animations and scripts: https://gyazo.com/ecc0c2781fa337608775d7933642f7be
I need to fix this script below [Dont add the code block lines.]
-- Waits for the child of the specified parent
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local Tool = script.Parent
local Animations = {}
local MyHumanoid
local MyCharacter
local function PlayAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Play()
end
end
local function StopAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Stop()
end
end
function OnEquipped(mouse)
MyCharacter = Tool.Parent
MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
if MyHumanoid then
Animations['EquipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'EquipAnim5'))
end
PlayAnimation('EquipAnim')
end
function OnUnequipped()
for animName, _ in pairs(Animations) do
StopAnimation(animName)
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
WaitForChild(Tool, 'PlaySlash').Changed:connect(
function (value)
--if value then
PlayAnimation('SlashAnim')
--else
-- StopAnimation('SlashAnim')
--end
end)
WaitForChild(Tool, 'PlayThrust').Changed:connect(
function (value)
--if value then
PlayAnimation('ThrustAnim')
--else
-- StopAnimation('ThrustAnim')
--end
end)
WaitForChild(Tool, 'PlayOverhead').Changed:connect(
function (value)
--if value then
PlayAnimation('OverheadAnim')
--else
-- StopAnimation('OverheadAnim')
--end
end)

3 comments
Use block code, man
Psudar Very true its making me confused.
Go down to answers and see the block code