How to play animation from middle and not from starting?

I have a animation and want it to play from a certain point and not from starting.

Anyone knows how i can?

Looked it up. im pretty sure you can do Animation.TimePosition = insert number here
(Animation is the “AnimationTrack” object) I havent tested this tough since i dont have acces to do that right now

2 Likes

not working at all for me idk why

2 Likes

did you play the animation before setting the time?

1 Like

This should work

animationTrack:Play()
animationTrack:AdjustSpeed(0) -- Freeze the animation
animationTrack.TimePosition = Insert number
animationTrack:AdjustSpeed(1) -- UnFreeze the animation
2 Likes

Still not working

I played the animation on a character model and if clicked on its part then it should play the animation for the player exactly from where its currently playing for that character model

---playing anim for character model
local Animation = Instance.new("Animation")
Animation.AnimationId =  "rbxassetid://17671321542"
local AnimationTrack = script.Parent.Humanoid.Animator:LoadAnimation(Animation)
AnimationTrack.Priority = Enum.AnimationPriority.Action3
AnimationTrack.Looped = true
AnimationTrack:Play()

AnimationTrack.Stopped:Connect(function()
	AnimationTrack:Play()
end)

print("played")

for _, part in ipairs(script.Parent:GetChildren()) do
	
	if part:IsA("BasePart") or part:IsA("MeshPart") then
		
		local clickDetector = Instance.new("ClickDetector")
		clickDetector.Parent = part
		
		clickDetector.MouseClick:Connect(function(player)
			
---playing anim for the player character if he clicks on the character model
			local timeStamp = AnimationTrack.TimePosition

			local Animation1 = player.Character.Humanoid.Animator:LoadAnimation(Animation) :: AnimationTrack
			-- loads the animation
			Animation1.Priority = Enum.AnimationPriority.Action3
			
			Animation1:Play()
			
			Animation1:Play()
			Animation1:AdjustSpeed(0) -- Freeze the animation
			Animation1.TimePosition = timeStamp
			Animation1:AdjustSpeed(1) -- UnFreeze the animation
			
			Animation1.Stopped:Connect(function()
				Animation1:Play()
			end)
						
		end)
	end
end```
1 Like

you have 2 animations with the same priority. im not good with animations but that might be causing an issue?

AnimationTrack.Stopped:Connect(function()
	AnimationTrack:Play()
end)

This is useless since the AnimationTrack.Looped is set to “true”

I also noticed you are playing Animation1 2 times instead of 1
Could you try printing timeStamp before you play Animation1?

1 Like

No it dont? The AnimationTrack is the playing animation track for the character model.

AnimationTrack.Stopped:Connect(function()
	AnimationTrack:Play()
end)

which will be playing again and again

And the Animation1 is the animation track for player, which should play from the TimePosition of the character model (AnimationTrack)

1 Like

It is useless since you set the property “looped” to true. this means that it will loop without you having to play it again

1 Like

its not looping that’s why i added that.

But the problem is TimePosition is not working

1 Like

Can you print “timeStamp” before Animation1 plays?

1 Like

I was. It was printing some different values wherever i clicks on the character model.

Can you tell me the values?

–Character neededddddd

image
This is the all script i have it plays animation for a dummy and when a players click on the dummy it should play the anim for the player too from exact same timePosition of the animation playing for the dummy

(script pasted in above reply)

I have no idea what might be the problem except for two things:

  1. Maybe try removing the :AdjustSpeed()'s?
  2. Changing the priority

Already have tried playing anim using a local script. Same result i got not working.
I though playing from sever side might work.

You guys can try the script put that in a character model and the animation is from toolbox so it should play for you too. Check if its sync for you or now

personally i cant try it myself since im not at home

I wasnt using this function :AdjustSpeed() before but the documentation says to use Time Position with this function.

yea np just pasted the script. If someone need it.

According to that article it should work without the speed adjusters but i got no idea. i dont know much about animations