Hello, im making a mafia game with voice chat feature. and i animated and scripted Revolver. and i set animation priority to Action(Action - Recommended priority for character actions that must override idle and locomotion animations.)
And i test the game, equip the tool, and animation is reversing.
Help me fix the bug, i tried all animation priority and it’s not working
Well, i use moon animator 2 to animate it, and when i publish to roblox, reverse bug happend when i tested the game and equip the tool. I imported to roblox animator editor to change animation priority, it’s not fixed the problem.
--[[
REVOLVER CLIENT SCRIPT
BY DRJOEDEV
FROM MIC_MAFIA
]]--
-- Tool Varibles
local Tool = script.Parent
local Handle = Tool.Handle
-- ReplicatedStorage, Modules, Models
local RS = game:GetService("ReplicatedStorage")
local RevloverModule = require(RS.Modules.Weapons.Revolver_Module)
-- Player Varibles
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humnaoid = Character:WaitForChild("Humanoid")
-- Animation's ID
local EquipID = "rbxassetid://17791365163"
local EquipAnim = Instance.new("Animation")
EquipAnim.AnimationId = EquipID
local RevolverWorker = RevloverModule.Start(Humnaoid,Tool,Handle)
Tool.Equipped:Connect(function()
local HumanoidEquipAnim = Humnaoid:LoadAnimation(EquipAnim)
HumanoidEquipAnim:Play()
task.wait(0.5)
HumanoidEquipAnim:Pause()
end)
I already have a module that you paste ID of animation it will play it (writed in OOP).
But in client script i did use it, and immediately delete code and use standard method, if this is problem with my code, idk i write code very well
This is probably the problem, as Humanoid:LoadAnimation() is deprecated. You should use Animator:LoadAnimation(), which is an instance parented under the Humanoid instance.
pausing the anim is not exactly a reliable method to make an idle animation, since roblox is kinda weird.
a better solution would be to make a separate idle animation (you could copy and paste ur equip anim’s last keyframes) and have it loop, then you can do this:
-- ur previous stuff above --
local IdleId = -- insert id here
local IdleAnim = Instance.new("Animation")
IdleAnim.AnimationId = IdleId
Tool.Equipped:Connect(function()
local HumanoidEquipAnim = Humnaoid:LoadAnimation(EquipAnim) -- u wrote humnaoid in the variables btw
local HumanoidIdleAnim = Humnaoid:LoadAnimation(IdleAnim)
HumanoidEquipAnim:Play()
HumanoidEquipAnim.Stopped:Connect(function() -- <-- this isn't completely necessary but it's just nice to have over the task.wait() incase u wanna change the anim anytime
HumanoidIdleAnim:Play()
end)
end)