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

Why do these custom character animations lag? --Update--

Asked by
Chronomad 180
9 years ago

I've been experimenting with my custom characters in my spare time for some weeks now, attempting to pinpoint the source of a heinous spike in lag. I've finally found that whenever the animations in my custom character are active, my framerate dips drastically. For example, when I begin walking and stop, causing the idle animation to play, my FPS will dip about 5 - 6 frames and Remain at that level. I'm thinking that perhaps the animations are being fired In rapid succession however I am unsure. Can anyone provide some insight and help me debug this? Thanks. The script that animates the model is below.

--UPDATE-- I've removed the animations that don't seem relevant to the problem, and added a debounce. The debounce seemed to correct the issue of the idle animation firing too many times, however if the player taps the w quickly enough, the frames will begin to dip again.

001    -- Ibethia is on the planet Tirren!
002 
003    local player = game:GetService('Players').LocalPlayer
004    Debounce = true
005    local already_ran = false
006    local grounded = false
007    --local idleAnimation = Instance.new("Animation")
008   -- idleAnimation.AnimationId = "rbxassetid://356344446"
009    --local Left = Instance.new("Animation")
010    --Left.AnimationId = "rbxassetid://356869859"
011    --local Right = Instance.new("Animation")
012    --Right.AnimationId = "rbxassetid://326922088"
013    --local Forward = Instance.new("Animation")
014    --Forward.AnimationId = "rbxassetid://312976450"
015    --local Backward = Instance.new("Animation")
View all 135 lines...
0
Try using WaitForChild instead of the repeat wait() until player.Character TheHospitalDev 1134 — 9y

1 answer

Log in to vote
1
Answered by
Edenojack 171
9 years ago

Best advice I can give is try and isolate exactly which animation(s) is causing the lag. And perhaps rename the animations from "Parent". By seeing exactly which animation is causing the lag, it may help find the cause of it in the code, but an initial lookthrough isn't bringing anything to my attention.

0
The lag seems to start when I start walking and then stop, which plays the idle animation, as well as when I jump rapidly. I watched my framerate for 5 minutes without moving, allowing the idle animation to play and my FPS did not change. It only seems to really happen when the idle animation is played right after another animation. Chronomad 180 — 9y
Ad

Answer this question