Animation NOT working properly on players but working properly on dummies

Hello! ive been working on a finisher system and im facing an issue with animations playing. When I finisher a dummy it works fine, however when I finisher a player the animation sometimes dosent play and is delayed. If anyone could help me out that would be great!
Thanks for reading :grinning_face_with_smiling_eyes:
My code:

local function Finisher2()
	ContextActionService:BindAction("Finisher2", function(action, state, input)
		for _,v in pairs(workspace:GetDescendants())do
			local TargetChar = v.Parent
			if Character:FindFirstChildOfClass("Tool") then
				if v.Name == "HumanoidRootPart" and v.Parent:FindFirstChild("Humanoid") and TargetChar.Name ~= Character.Name and v.Parent:FindFirstChild("Humanoid").Health ~= 0 then
					if (Character.HumanoidRootPart.Position - v.Position).Magnitude >=15 and TargetChar.Name ~= Character.Name and v.Parent:FindFirstChild("Humanoid").Health <= 100 and InFatality == false then
						if (Character.HumanoidRootPart.Position - v.Position).Magnitude <=20 then
							game.ReplicatedStorage.Remotes.TargetCharReplication:FireServer(Character:FindFirstChildOfClass("Tool").Model.Model.Muzzle,TargetChar,Character,"Finisher2")
							local FartherDeathAnimation = game.ReplicatedStorage.Assets.FartherDeathAnimation:Clone()
							local FartherDeathAnim
							FartherDeathAnim = TargetChar.Humanoid:LoadAnimation(FartherDeathAnimation)
							local CameraForFinisher = game.ReplicatedStorage.Assets.Camera:Clone()
							CameraForFinisher.Parent = workspace
							CameraForFinisher:SetPrimaryPartCFrame(Character.HumanoidRootPart.CFrame * CFrame.new(0,-1,0))
							CameraForFinisher.Humanoid:LoadAnimation(CameraForFinisher.Anim):Play()
							repeat
								workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
								workspace.CurrentCamera.CFrame = CameraForFinisher.Camera.CFrame
							until workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable
							game:GetService("RunService"):BindToRenderStep("Finisher",299,function()
								workspace.CurrentCamera.CFrame = CameraForFinisher.Camera.CFrame
							end)
						game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
						Character.HumanoidRootPart.Anchored = true
						InFatality = true
						ContextActionService:UnbindAction("MouseHold")
						ContextActionService:UnbindAction("Roll")
						TargetChar.HumanoidRootPart.CFrame = Character.TargetPart2.CFrame
						Anim2 = Character.Humanoid:LoadAnimation(FinisherAnimation2)
						Anim2:Play()FartherDeathAnim:Play()
						wait(3)
						CastModule:RecoilEffect()
						for _,v in pairs(Character:FindFirstChildOfClass("Tool").Model.Model.Muzzle:GetChildren())do
							if v:IsA("PointLight") or v:IsA("ParticleEmitter") then
								v.Enabled = true
							end
						end
						wait(.1)
						for _,v in pairs(Character:FindFirstChildOfClass("Tool").Model.Model.Muzzle:GetChildren())do
							if v:IsA("PointLight") or v:IsA("ParticleEmitter") and v.Name ~= "smoke trail" then
								v.Enabled = false
							end
						end
						wait(1)
						for _,v in pairs(Character:FindFirstChildOfClass("Tool").Model.Model.Muzzle:GetChildren())do
							if v.Name == "smoke trail"then
								v.Enabled = false
							end
						end
						Character.HumanoidRootPart.Anchored = false
						InFatality = false
							repeat
								workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
							until workspace.CurrentCamera.CameraType == Enum.CameraType.Custom
						game:GetService("RunService"):UnbindFromRenderStep("Finisher")
							CameraForFinisher:Destroy()
							wait(.1)
							Character:FindFirstChildOfClass("Tool").Parent = LocalPlayer.Backpack
							wait(.1)
							LocalPlayer.Backpack:FindFirstChildOfClass("Tool").Parent = Character
							game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
						Roll()
							print("Finished")
						break
                        end
					end
				end
			end
		end
	end, false, Enum.KeyCode.Q)
end
game.ReplicatedStorage.Remotes.TargetCharReplication.OnClientEvent:Connect(function(Muzzle,TargetChar,Char,Type)
	
	if TargetChar.Name == LocalPlayer.Name then
		ContextActionService:UnbindAction("MouseHold")
		ContextActionService:UnbindAction("Roll")
		ContextActionService:UnbindAction("Finisher1")
		ContextActionService:UnbindAction("Finisher2")
	end
	
	if Type =="Finisher1" then
		if Character.Name == Char.Name then
			print("Already loaded anim")
		else
			
		local Anim_ = game.ReplicatedStorage.Assets.DeathAnimation:Clone()
		local Anim
		Anim = TargetChar.Humanoid:LoadAnimation(Anim_)
		Anim:Play()
end
	repeat
		TargetChar.HumanoidRootPart.CFrame = Char.TargetPart.CFrame
	until wait(.3)
	wait(1.3)
	local Blood = game.ReplicatedStorage.Assets.BloodPart:Clone()
	Blood.Parent = workspace
	Blood.Position = TargetChar.Head.Position
	for _,v in pairs(Blood:GetChildren())do
		if v:IsA("ParticleEmitter") then
			v:Emit(50)
		end
	end
	wait(.1)
	Muzzle.GunShot:Play()
	local BreakEffect = game.ReplicatedStorage.Assets.BreakEffect:Clone()
	BreakEffect.Parent = workspace.Ignore
	BreakEffect:SetPrimaryPartCFrame(TargetChar.PrimaryPart.CFrame * CFrame.new(0,0,.7) * CFrame.fromEulerAnglesXYZ(0,-0.25,0))
	spawn(function()
		wait(1)
		BreakEffect:Destroy()
		end)
	else
		if Type == "Finisher2" then
			if Character.Name == Char.Name then
				print("Already loaded anim")
			else
			local Anim_2 = game.ReplicatedStorage.Assets.FartherDeathAnimation:Clone()
			local Anim2
			Anim2 = TargetChar.Humanoid:LoadAnimation(Anim_2)
			Anim2:Play()
			end
			repeat
				TargetChar.HumanoidRootPart.CFrame = Char.TargetPart2.CFrame
			until wait(.5)
			TargetChar.HumanoidRootPart.CFrame = Char.TargetPart2.CFrame
			wait(3)
			local Blood = game.ReplicatedStorage.Assets.BloodPart:Clone()
			Blood.Parent = workspace
			Blood.Position = TargetChar.Head.Position
			for _,v in pairs(Blood:GetChildren())do
				if v:IsA("ParticleEmitter") then
					v:Emit(50)
				end
			end
			Muzzle.GunShot:Play()
		end
	end
end)

Here is a video displaying it:

4 Likes

Does it work properly on players characters NPC clones?

Yeah it does work properly on them

More questions:

  1. Does it not work properly for both clients?
  2. Does executing 2 players characters in total in one game does not work properly twice?
    I came up with a potential solution and I’m not sure about it (after answering the question I will still probably be unsure about my solution).

I’m not sure, but I think it’s because the other player owns his character and that delay is because they don’t sync.

You could use SetNetworkOwner and set both Characters to nil and run the animation from the server:

for i,v in pairs(Character:GetDescendants()) do
	local CanSet,Err = v:CanSetNetworkOwnership()
	if v:IsA("BasePart") and CanSet then
		v:SetNetworkOwner(nil)
	elseif v:IsA("BasePart")  then
		print(Err)
	end
end

Sources:

Hope this can help you.

1 Like
  1. It works properly for the other client although sometimes it will bug out
    2.? I don’t understand what your asking

Oooo I’ll look into this for sure once I get on my pc

The second question is not important anymore because of the given solution (most likely). I meant something like this:

  1. Play a game and execute two players characters
  2. Answer the question: Did it not work properly twice?
    As I said the answer will most likely won’t matter.

Yeah it dosent work properly at all

Looked into it and it looks a lot better! Thanks for the help

1 Like