My animations are smooth when I play them in the animation editor, but when played in-game, they look weird and choppy. I've looked at others describing the same issues, but the solutions either don't work for me (such as animation weights and priorities) or are outdated.
Video of both editor and in-game animation: https://streamable.com/d9dqr7
Code used to play counterattack animation (local script):
local UserInputService = game:GetService("UserInputService") local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local debounce = false local ReplicatedStorage = game:GetService("ReplicatedStorage") local swordDamage = ReplicatedStorage.SwordDamageRemoteFunction local beingUsed = ReplicatedStorage.BeingUsedRemoteFunction local CurrentAction = script.Parent.Parent.CurrentAction.Value --[[local AudioPlayerModule = require(ReplicatedStorage:WaitForChild("AudioPlayer") AudioPlayerModule.preloadaudio({ })]] --[[ 11768323667 right 11768327293 up 11768331665 left ]] repeat wait() until character.Humanoid local humanoid = character.Humanoid local anim = Instance.new("Animation") anim.Parent = humanoid anim.AnimationId = "https://www.roblox.com/asset/?id=11762237171"--11749156719 local playAnim = humanoid:LoadAnimation(anim) UserInputService.InputBegan:Connect(function(Input , IsTyping) if not IsTyping and not debounce and Input.UserInputType == Enum.UserInputType.MouseButton1 then debounce = true wait(0.1) playAnim:Play(0, 1, 1) CurrentAction = "Slice" swordDamage:InvokeServer(character.SliceDamage.Value, true, 0.5, true) --sound goes here --AudioPlayerModule.playAudio("") end local seconds = 0 repeat seconds += 0.1 wait (0.1) until seconds >= 2 or CurrentAction ~= "Slice" playAnim:Stop() swordDamage:InvokeServer(0, false, false, false) beingUsed:InvokeServer() if seconds >= 2 then CurrentAction = nil end debounce = false end)
Code used for idle animation (local script):
local tool = script.Parent local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/Asset?ID=11749602892" local track tool.Equipped:Connect(function() track = script.Parent.Parent.Humanoid:LoadAnimation(anim) track.Priority = Enum.AnimationPriority.Action track.Looped = true track:Play() end) tool.Unequipped:Connect(function() if track then track:Stop() end end)
It seemed to lag when it printed "table reset" Is that a bulky table or something lol?