Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why Wont My Animation Play? There is no Errors

--| References:
local _Players = game:GetService("Players");
local _ReplicatedStorage = game:GetService("ReplicatedStorage");

local _RemoteEvents = _ReplicatedStorage:WaitForChild("RemoteEvents");
local _DamageEnemyEvent = _RemoteEvents:WaitForChild("DamageEnemy");

local _Player = _Players.LocalPlayer;

local _Tool = script.Parent;
local _Configuration = _Tool:WaitForChild("Configuration");

local _Damage = _Configuration:WaitForChild("Damage");
local _CriticalDamage = _Configuration:WaitForChild("CriticalDamage");

local _Blade = _Tool:WaitForChild("Blade");
local _Animations = _Tool:WaitForChild("Animations");

--| Variables:
local _Equipped = false;
local _Debounce = false;

--| Cached Functions:
local random = math.random;

--| Functions:
local function Clicked()
	if _Equipped and not _Debounce then
		_Debounce = true;
		local _Character = _Tool.Parent;
		
		--Make a random animation selector
		print(_Character.Humanoid.Name);
		local AnimTrack = _Character.Humanoid:LoadAnimation(_Animations.SwordSlash1);
		AnimTrack:Play();
		
		wait(0.7);
		
		_Debounce = false;
	end
end

local function Equipped()
	_Equipped = true;
end

local function Unequipped()
	_Equipped = false;
end

--| Function Connections:
_Tool.Activated:connect(Clicked)
_Tool.Equipped:connect(Equipped);
_Tool.Unequipped:connect(Unequipped);

This script is a local script inside of a tool. When I test it, it doesn't display any errors and so I'm wondering why the animation doesn't play. If anyone can help me out that would be great. Thanks!

2 comments

0

It has to do with your animations

0

I was kind of thinking that, I'll remake the animation. Thanks!

1 answer

It's most likely your animation as the code is flawless and amazing looking.

This discussion is preserved as it was. New answers, comments, and votes are closed.