Ha… hello again, Developers. I once again find myself on the brink of insanity coding a game that I definitely do not have enough skill for.
This time, I greet you all, ashamed, with a look into how horrible my punch animation code is, playing every time the user clicks:
if players.LocalPlayer.CharacterData.Moveset == "Mokou" then --never do this. there has to be a faster way.
if count == 1 then --Funny. Who knew you could animate on the client and it would auto replicate to the server?
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://76593291004229"
local track = animator:LoadAnimation(animation)
track:Play()
task.wait(animLength)
elseif count == 2 then
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://90977379848094"
local track = animator:LoadAnimation(animation)
track:Play()
task.wait(animLength)
elseif count == 3 then
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://138453285755703"
local track = animator:LoadAnimation(animation)
track:Play()
MokouFireHandler:FireServer(char["Right Arm"], "Punch3")
task.wait(animLength)
elseif count == 4 then
print("Nothing here yet!")
end
elseif players.LocalPlayer.CharacterData.Moveset == "Sen/Sin" then
if count == 1 then
print("Nothing here yet!")
elseif count == 2 then
print("Nothing here yet!")
elseif count == 3 then
print("Nothing here yet!")
elseif count == 4 then
print("Nothing here yet!")
end
elseif players.LocalPlayer.CharacterData.Moveset == "Sakuya" then
if count == 1 then
print("Nothing here yet!")
elseif count == 2 then
print("Nothing here yet!")
elseif count == 3 then
print("Nothing here yet!")
elseif count == 4 then
print("Nothing here yet!")
end
end
Yes, yes, I know. It’s an abomination. But I’m not knowledgeable enough to make this better. I come to you all asking two things:
- Please tell me if there’s a way to optimize this, and if there is, how?
- Why aren’t the animations playing?
Just so you know, animator is defined as the LocalPlayer.Character.Humanoid.Animator.
I… kind of desperately need assistance. And my other scripters in this project, who are both better than me, haven’t been active in a while. So please, tell me how I can optimize this and how to make the animations work..