Could anyone explain the issue with animations in this code? It supposedly works fine with most sword models but It doesn't with mine, which for reference is an imported .fbx file from blender. Is there a quick way to fix this issue or would I need a whole new code and model to make animations work. (I know the fix is probably simple, but I am still at a very early I got no idea what I'm doing state)
#Custom animations not working
1 messages · Page 1 of 1 (latest)
reference animator and not humanoid
new Roblox stuff, it used to work like this but now it’s deprecated in humanoid
this should automatically be created and be a descendant of humanoid in a character
ts looks ass
I have tested it with an animator humanoid but it still wouldnt do anything after clicking
Thats why I am here lol
Aight ty
is the animation Tool<Animation?
Tool.Animation?
for in a folder or sum
@warm river
okay
```lua
local Tool = script.Parent
local Handle = Tool:FindFirstChild("Handle")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer or Players.PlayerAdded:Wait()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character and Character:FindFirstChild("Humanoid")
local Animation = Tool:FindFirstChild("Animation")
local Sound = Handle and Handle:FindFirstChild("Slash")
local Animator = Humanoid and Humanoid:FindFirstChildOfClass("Animator")
local SwingTrack = Animator and Animator:LoadAnimation(Animation)
local Cooldown = false
local function Swing()
if Cooldown then return end
Cooldown = true
SwingTrack:Play()
Sound:Play()
task.delay(1, function()
Cooldown = false
end)
end
Tool.Activated:Connect(Swing)
** You are now Level 6! **
the current one i use is r6
i got both r15 and 6 though
should i try this with the r15 one
bro
r6 animation only works on r6
and same with r15
to be sure try this
```lua
local Tool = script.Parent
local Handle = Tool:FindFirstChild("Handle")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer or Players.PlayerAdded:Wait()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character and Character:FindFirstChild("Humanoid")
local Animation = Tool:FindFirstChild("Animation")
local Sound = Handle and Handle:FindFirstChild("Slash")
local Animator = Humanoid and Humanoid:FindFirstChildOfClass("Animator")
local SwingTrack = Animator and Animator:LoadAnimation(Animation)
if SwingTrack then SwingTrack.Priority = Enum.AnimationPriority.Action end
local Cooldown = false
local function Swing()
if Cooldown then return end
Cooldown = true
SwingTrack:Play()
Sound:Play()
task.delay(1, function()
Cooldown = false
end)
end
wait
@warm river try this
add a print("x") after the if cooldown then return end
if it prints, its not the script
shit wait
I dont see a message
```lua
local Tool = script.Parent
local Handle = Tool:FindFirstChild("Handle")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer or Players.PlayerAdded:Wait()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character and Character:FindFirstChild("Humanoid")
local Animation = Tool:FindFirstChild("Swing")
local Sound = Handle and Handle:FindFirstChild("Slash")
local Animator = Humanoid and Humanoid:FindFirstChildOfClass("Animator")
local SwingTrack = Animator and Animator:LoadAnimation(Animation)
if SwingTrack then SwingTrack.Priority = Enum.AnimationPriority.Action end
local Cooldown = false
local function Swing()
if Cooldown then return end
Cooldown = true
SwingTrack:Play()
Sound:Play()
task.delay(1, function()
Cooldown = false
end)
end
Tool.Activated:Connect(Swing)
use this
i forgot ur animation name was "Swing"
It doesn't work again, I dont see a print at all
** You are now Level 2! **
Honestly youve done enough, it might just be a corrupted model or smth idk
something weird
the script they're referencing is in a local context
bro it works to me
use a local script
i used local script
it is a local script
Ignore the second sound and the event, thats for the later stuff. But the code is placed on a local script and the animations there
is that an issue
ofc
okay hold on it worked now
and you will be fine i guess
It was that name originally but after a ton of changing i accidentely turned it to slash
mb
i changed it now though
works?
completely flawless
ty
and if it doesnt take too long
act nevermind i wont ask anything else
thats like 4x harder yk
I know
you as well
sure