Animation Stopped event Runs when the animation is looped

That’s fine but why do you need the event?

well im making a emote system and i wanted to update the state of the player based on if he is emoting or not and it just seems logical that there would be a event for handling that or that Stopped will not include Loops (Since there is already the DidLoop event)

local event = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("Emote")
local EmoteList = game:GetService("ReplicatedStorage"):WaitForChild("Emotes")
local SfxHandler = require(game:GetService("ServerStorage"):WaitForChild("Modules"):WaitForChild("SFXHandler"))
local AO = require(game:GetService("ServerStorage"):WaitForChild("Modules"):WaitForChild("AOHandler"))

event.OnServerEvent:Connect(function(p,char,name,player,Looped)


	if player then
	



	if char:GetAttribute("State") ~= "idle" and char:GetAttribute("State") ~= "Emoting" then return end
	
	

	end
	
	
	for i,v in char.Humanoid.Animator:GetPlayingAnimationTracks() do

		v:Stop()

	end

	local Emote = EmoteList:FindFirstChild(name)

	local Sound = Emote:FindFirstChild("emotesound")

	local speed = Emote:GetAttribute("speed")

	char.Humanoid.WalkSpeed = speed

	local LoadedEmote =char.Humanoid.Animator:LoadAnimation(Emote)
	if Looped then
	LoadedEmote.Looped = Looped
	end
	char.Humanoid.JumpPower = 0
	LoadedEmote:Play()
	char:SetAttribute("State","Emoting")

	if player then
		SfxHandler.playSoundFrom(Sound,char.HumanoidRootPart)


	for i,v in Emote:GetChildren() do
		if v:IsA("Part") or v:IsA("MeshPart") then
			if v:GetAttribute("Hold") then

				AO.AddObjectD(LoadedEmote,v,char:WaitForChild(v:GetAttribute("Hold")),v.CFrame)
			else 
				AO.AddObjectD(LoadedEmote,v,char:WaitForChild("Right Arm"),v.CFrame)
			end
		end

		if v:IsA("Model") then
			if v:GetAttribute("Hold") then

				AO.AddObjectD(LoadedEmote,v,char:WaitForChild(v:GetAttribute("Hold")),v.CFrame)
			else 
				AO.AddObjectD(LoadedEmote,v,char:WaitForChild("Right Arm"),v:GetPivot())
			end




		end
	end

	end
	


	
	

	LoadedEmote.Stopped:Connect(function()

		if char:GetAttribute("State") == "Emoting" then
		char:SetAttribute("State","idle")
		end
		LoadedEmote:Stop()
		char.Humanoid.JumpPower = 50
		SfxHandler.StopSoundFrom(char.HumanoidRootPart)



	end)



end)
``` this is my code im still struggling to implement a custom "event" for that since there is just too many possibilities where the animation will stop

I’m sorry I can’t check your script right now as I’m working on something myself. Based on your earlier explanation, it seems like you are tryin to see if the player is emoting or not and then update their “state” based on whether they are emoting.

Since you also said that it’s hard to know when the animation stops, what if you a create a bool value, and run the AnimationTrack.Stopped event, and when the animation stops for the first time, you turn the bool on/off and go from there?

Also, message me private if there’s still more after this cuz the admins will complain I think

Did u even try my solution?

It is as simple as that.
IF u want me to write a whole paragraph explaining stuff, just ask/say. Maybe i sound rude or sum, but just try.

LoadedEmote:GetMarkerReachedSignal(The name of the event thingy):Connect(function()

	if char:GetAttribute("State") == "Emoting" then
		char:SetAttribute("State","idle")
	end
	LoadedEmote:Stop()
	char.Humanoid.JumpPower = 50
	SfxHandler.StopSoundFrom(char.HumanoidRootPart)



end)

no i know what this is but its not really gonna work on a Looped animation

But it will buddy, try it.

Char limitttttt

It really doesn’t it’s not even related to my question

Your question is:

You can add ur own custom function?

I see now that ur question is now even worse to understand. What are you trying to achieve?

Well im trying to achieve what i said in the original post i need to detect when a emote animation has stopped or ended and exclude when the animation looped

AnimationTrack.IsPlaying doesn’t get set to false when the animation loops. So, you could run AnimationTracked.Stopped and have an if statement that checks for AnimationTrack.IsPlaying. If AnimationTrack.IsPlaying is true, it means that the animation looped. If AnimationTrack.IsPlaying is false, it means that the animation ended

forgot that it has that property thanks!

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