Snapping animation

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Making an equip animation but when i use the animation first time after starting a game, it snaps back into it’s position
  2. What is the issue? Include screenshots / videos if possible!

Can you consider showing your code? Also this belongs in #help-and-feedback:scripting-support.

My assumption for the issue is that you’re loading the idle animation too late. Use a local script and preload the animations to the humanoid.

2 Likes
Flashlight.Activated:Connect(function()
	local Anim = Animator:LoadAnimation(RepStorage.Toggle)
	Anim:Play()
	
	Anim:GetMarkerReachedSignal("On"):Once(function()
		if Light.Enabled == false then
			ContextAction:BindAction("FOV", FOV, false, Enum.KeyCode.E)
			Light.Enabled = true
		elseif Light.Enabled == true then
			ContextAction:UnbindAction("FOV")
			Light.Enabled = false
		end
	end)
end)

Flashlight.Equipped:Connect(function()
	local Equip = Animator:LoadAnimation(RepStorage.Equip)
	Equip:Play()

	Equip.Stopped:Once(function()
		AnimateDefault.Enabled = false
		AnimateFlashlight.Enabled = true
	end)
end)

Flashlight.Unequipped:Connect(function()
	AnimateDefault.Enabled = true
	AnimateFlashlight.Enabled = false
end)

The reason why is because the animation has not loaded yet. This only happens to the first person to use it.

I have no idea how to fix it other than having a side model to play all the animations in the start of the game to load them.

1 Like

I guess content provider service

I am unfamiliar with that but give it a shot!

1 Like

It worked
Here is the code

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character : Model = Player.Character or Player.CharacterAdded:Wait()

local ContentProvider = game:GetService("ContentProvider")


for _, Item in Character:GetDescendants()  do
	if Item:IsA("Animation") then
		ContentProvider:PreloadAsync({Item})
	end
end

Thanks for help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.