Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Aim animations won't play for a second time?

Asked by 5 years ago

Hello, My code is fully functional, and I'm getting no errors out of the developers console, but I cannot figure out why the "aim" animation won't play again after you disable it with Q and it successfully plays the Hold animation, but when you press Q again, it should play the aim animation but for some reason it stays at the hold animation. The animation all together works, so this is why I have come to scriptinghelpers.org to seek help for this weird behavior. My code: https://hastebin.com/ejebetupoy.rb Any help is appreciated. Any further questions/concerns of this code should be directed towards the comments or via Discord RookPvPz#8960

Thanks, Rook

1 answer

Log in to vote
0
Answered by 5 years ago

Don't use Mouse, because it is deprecated. That means that Roblox doesn't make changes to that function anymore. It might break soon. So instead of Mouse, use UserInputService. For more information on UserInputService, visit here

Also, instead of making a function off of an event, make it ahead of time. That's why it's doing that. So you can make a function for the animation itself. So you can do

local function loadAnim(animid, player, char)
    local anim = Instance.new("Animation",player)
    anim.Name = "Aim"
    anim.AnimationId = "rbxassetid://"..tonumber(00000) -- your animation id
    char.Humanoid:LoadAnimation(anim)
end

Then call that function when you want to play the animation.

That's about it.

Hopefully this helped. If it did, let me know. If it didn't, let me know, and I'll try to fix it.

Good luck with your game!

0
That does not fix his problem, unfortunately. DeceptiveCaster 3761 — 5y
Ad

Answer this question