Annoying animation bug ingame (Door animation is too strong)

I don’t know what’s causing this damn bug but it’s constantly happening to me no matter what object I animate no matter what priority or what I disable or don’t. It’s seriously starting to piss me off because I’ve spend almost 2 days fixing this stupid issue with animations.

It’s opening the door 30x stronger ingame than in the actual playback of the animation in studio. Everything is literally rigged and setup correctly

Code doesn’t even want to show up after I edit it on this website.

local Door = script.Parent

local Animator = Door.Humanoid.Animator
local OpenAnimation = Animator:LoadAnimation(script.Open)
local CloseAnimation = Animator:LoadAnimation(script.Close)
local RunService = game:GetService("RunService")
local OpenSound = Door.Door.DoorInner.Open
OpenAnimation.Priority = Enum.AnimationPriority.Action
CloseAnimation.Priority = Enum.AnimationPriority.Action
OpenAnimation:AdjustWeight(10)
local DoorStatus = false

local function Open()
	OpenAnimation:Play()
end

local function Close()
	CloseAnimation:Play()
end

Door.Door.Handle.ProximityPrompt.Triggered:Connect(function()
	Open()
end)
External Media External Media
3 Likes

I’m not gonna lie, I’ve taken a good look at both of them 2 times and it looks like it’s working fine though

Ah I see it now, the footage just went by so quick

I think I have an idea why, what frame rate did you animate the door in inside of Moon Animator?

1 Like

Frame rate doesn’t matter. I’ve used Blender, Roblox’s animator, and Moon animator all on 30 and 60 fps uploading around 6 animations in total only for ALL of them to give me the same results.

Actually frame rate does matter but I digress, have you had this issue with other animations?

Yes I have another door that is also having the same issue even when I change the framerate no matter what.

1 Like

What if I told you there was more then what meets the eye, what if you could hold the power to animate any door you wanted smoothly(and accurately)?

1 Like
local Door = script.Parent
local Animator = Door.Humanoid.Animator
local OpenAnimation = Animator:LoadAnimation(script.Open)
local CloseAnimation = Animator:LoadAnimation(script.Close)
local OpenSound = Door.Door.DoorInner.Open

-- Set animation priorities
OpenAnimation.Priority = Enum.AnimationPriority.Action
CloseAnimation.Priority = Enum.AnimationPriority.Action

-- Ensure animations are at their default speed and weight
OpenAnimation:AdjustSpeed(1)
CloseAnimation:AdjustSpeed(1)
OpenAnimation:AdjustWeight(1)
CloseAnimation:AdjustWeight(1)

local DoorStatus = false

local function Open()
    OpenAnimation:Play()
    if OpenSound then
        OpenSound:Play()
    end
end

local function Close()
    CloseAnimation:Play()
end

Door.Door.Handle.ProximityPrompt.Triggered:Connect(function()
    if DoorStatus then
        Close()
    else
        Open()
    end
    DoorStatus = not DoorStatus
end)
1 Like

If it has something to do with TweenService then I won’t take it because it doesn’t give me the results I want.

1 Like

This won’t work either, I highly doubt it could be a scripting issue due to the fact that no matter how I script it, the door keeps going into the wall completely and ending up on the other side instead of right next to the frame.

1 Like

You have to open your mind @kalet14, there is always a solution

To start does your door have an AnimSaves folder?

1 Like

i have never seen devforum person act like that sorry :skull:

But yea I agree maybe

3 Likes

Yes it does, but I can’t open my mind to TweenService if I’ve already tried using it only for it to end up looking much worse than an if I used an animation. I’ve used Back for the easing style but it only makes it look worse compared to the animation option. I’ve never had this happen with any other Rig up until now.

2 Likes

Alright so my potential solution doesn’t need tweenservice and will still be smooth but you gotta work with me here, can I see the KeyframeSequence you have inside of the door

1 Like

Try spending 2 days fixing something crucial to your game that you spent hours on modeling, rigging, positioning, and animating only to find no solution at all and the only available alternatives end up looking 10x worse than if you used an animation.

Oh no sorry it wasn’t you it was the yellow faced guy he is funny to me so yes :joy:

2 Likes

Alright, so create a new module script and put it inside of ReplicatedStorage and paste all of this inside of it

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local CutsceneAnimation = {}
CutsceneAnimation.__index = CutsceneAnimation

function CutsceneAnimation.new(sequence : KeyframeSequence)
   local self = {}
   setmetatable(self, CutsceneAnimation)
   self.KeyframeSequence = sequence
   self.Keyframes = sequence:GetKeyframes()
   self.Frame = 1
   self.Motors = {}
   return self
end

function CutsceneAnimation:UpdatePose(frame, DT : number)
   for _, pose : Pose in ipairs(frame:GetDescendants()) do
      if pose:IsA("Pose") then
         local Motor = self.Motors[pose.Name]
         if Motor then
            local x,y,z = pose.CFrame:ToEulerAnglesXYZ()
            if x == 0 and y == 0 and z == 0 and pose.CFrame.Position.Magnitude == 0 then
               continue
            end
            Motor.Transform:Lerp(pose.CFrame, DT)
         end
      end
   end
end

function CutsceneAnimation:Play(Rig : Model, startCFrame : CFrame)
   local CutsceneRig = Rig
   self.CutsceneRig = CutsceneRig
   local accumulatedTime = self.AccumulatedTime or 0

   for _, motor in ipairs(self.CutsceneRig:GetDescendants()) do
      if motor:IsA("Motor6D") then
         self.Motors[motor.Name] = motor
      end
   end

   if not startCFrame then
      startCFrame = CutsceneRig.PrimaryPart.CFrame
   end

   CutsceneRig.PrimaryPart.Anchored = true
   CutsceneRig.PrimaryPart.CFrame = startCFrame

   CutsceneAnimation[Rig] = true

   table.sort(self.Keyframes, function(a, b)
      return a.Time < b.Time
   end)

   self:UpdatePose(self.Keyframes[self.Frame])

   local Connection = nil

   Connection = RunService.RenderStepped:Connect(function(DT)
      if self.Paused then return end

      accumulatedTime += DT

      while self.Frame < #self.Keyframes and accumulatedTime >= self.Keyframes[self.Frame + 1].Time  do
         self.Frame += 1
         self:UpdatePose(self.Keyframes[self.Frame], DT * 7)
      end


      if accumulatedTime >= self.Keyframes[self.EndKeyframe or #self.Keyframes].Time then
         Connection:Disconnect()
         Connection = nil
         CutsceneAnimation[Rig] = false
      end
   end)
end

return CutsceneAnimation

After you’ve done that wherever you’re like opening the door do this, the pathToKeyframeSequence is the KeyframeSequence of the animation you want to play

local CutsceneAnimation = require(game.ReplicatedStorage.CutsceneAnimation)

local pathToKeyframeSequence = ''
local DoorOpen = CutseceneAnimation.new(pathtoKeyframeSequence)
DoorOpen:Play()

Just please give it a shot and tell me what happens @kalet14

local CutsceneAnimation = require(game.ReplicatedStorage.CutsceneAnimation)

local pathToKeyframeSequence = script.Parent.AnimSaves.Untitled
local DoorOpen = CutsceneAnimation.new(pathToKeyframeSequence)

script.Parent.Door.Handle.ProximityPrompt.Triggered:Connect(function()
	DoorOpen:Play()
end)

It gives me this error for some reason. “ReplicatedStorage.CutsceneAnimation:36: attempt to index nil with ‘GetDescendants’”

1 Like

We’re gonna work through this I’m happy you decided to take a leap of faith, let me try to figure out the error

You didn’t pass the rig which is the first parameter of the play function!

@vicy98 Don’t steal my moment please