#Custom animations not working

1 messages · Page 1 of 1 (latest)

warm river
#

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)

lapis surge
#

reference animator and not humanoid

#

new Roblox stuff, it used to work like this but now it’s deprecated in humanoid

lapis surge
warm river
warm river
umbral frigate
#

I make u a better version

#

stay here

warm river
#

Aight ty

umbral frigate
#

is the animation Tool<Animation?

#

Tool.Animation?

#

for in a folder or sum

#

@warm river

warm river
#

Its on a tool\

#

the script

umbral frigate
#

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)

stuck depotBOT
#

studio** You are now Level 6! **studio

umbral frigate
#

try this

#

@warm river

#

tell me if it works

#

does it work @warm river

#

?

warm river
#

It still doesnt play the animation

#

is it a problem with my avatar or smth

umbral frigate
#

wait

#

is the animation r6 or r15?

warm river
#

the current one i use is r6

#

i got both r15 and 6 though

#

should i try this with the r15 one

umbral frigate
#

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
#

Still nothing

#

i am starting to believe its not the script

umbral frigate
#

add a print("x") after the if cooldown then return end

#

if it prints, its not the script

#

shit wait

warm river
#

I dont see a message

umbral frigate
#

⁨```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"

warm river
#

It doesn't work again, I dont see a print at all

stuck depotBOT
#

studio** You are now Level 2! **studio

warm river
#

Honestly youve done enough, it might just be a corrupted model or smth idk

#

something weird

lapis surge
#

the script they're referencing is in a local context

umbral frigate
#

bro it works to me

lapis surge
#

use a local script

umbral frigate
#

i used local script

warm river
#

it is a local script

umbral frigate
#

i used this structure

warm river
#

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

umbral frigate
#

in ur handle is no "Slash" dumbass

#

bro

#

your local script is in the handle

warm river
#

is that an issue

umbral frigate
#

ofc

warm river
#

waqit

#

wait

umbral frigate
#

put the local script under "Katana"

#

and Rename the sound you like into "Slash"

warm river
#

okay hold on it worked now

umbral frigate
#

and you will be fine i guess

warm river
#

for 1 swing

#

that is

umbral frigate
#

yea rename the sound

#

then it works

#

Rename the sound you like into "Slash"

warm river
#

It was that name originally but after a ton of changing i accidentely turned it to slash

#

mb

#

i changed it now though

umbral frigate
#

works?

warm river
#

completely flawless

#

ty

#

and if it doesnt take too long

#

act nevermind i wont ask anything else

umbral frigate
#

damage?

#

500 robux + tax

#

advanced hitbox system, super secure

warm river
#

I think I can figure dmg out myself

#

atleast i hope so-

umbral frigate
#

thats like 4x harder yk

warm river
#

I know

umbral frigate
#

i dont recommend you to try it

#

have fun i guess

warm river
#

you as well

umbral frigate
#

i give you a hint

#

@warm river

warm river
#

sure

umbral frigate
#

use the remote event

#

fire it when the animation played

#

after SwingTrack:Play()

#

put

#

Handle.SwingEvent:FireServer()

#

and on the server script

#

recieve the remote and make a part that damages in touch with check if player was already hit or not

#

sum like that

warm river
#

that

#

ill use that

#

probably