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

Animations causing massive lag?

Asked by
hwlq 2
4 years ago
Edited 4 years ago

I am using a script in a seat to play animations on it in our game, and when no one in the server is sitting on a seat, the FPS doubles compared to when someone is sitting in a seat.

Here is the seat script

seat = script.Parent
function added(child)
    if (child.className=="Weld") then
        human = child.part1.Parent:FindFirstChild("Humanoid")
        if human ~= nil then
            anim = human:LoadAnimation(seat.sitanim)
            anim.Looped = true
            anim:Play()
            print("hi")
        end
     end
end

function removed(child2)
    if anim ~= nil then
        anim:Stop()
        anim:Remove()
    end
end

seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)

------------------------------EDIT---------------------------------

It seems like it's not the seat script, but our animation handler itself. Anyone have any ideas why an animation handler would cause so much lag when running animations in game?

Answer this question