Problem with playing emote

  1. What do you want to achieve? Keep it simple and clear!

I want tp achive that when the player press the key G plays the equipped emote.

  1. What is the issue? Include screenshots / videos if possible!

The emote and emote sound dont play and dont give any error in the output.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried firing the event from the command executor but still didn’t work.

This is the localscript located in StarterCharacterScripts

local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local folder = script:WaitForChild("CurrentEmote")
local rs = game:GetService("ReplicatedStorage")
local animevent = rs:WaitForChild("PlayAnim")
local uis = game:GetService("UserInputService")

local anim = folder:WaitForChild("Animation")
local sound = folder:WaitForChild("Sound")

uis.InputBegan:Connect(function(input,gpe)
	if not gpe then
		if input.KeyCode == Enum.KeyCode.G then
			local char = plr.Character or plr.CharacterAdded:Wait()
			local hum = char:WaitForChild("Humanoid")
			
			animevent:FireServer(anim,sound)
		end
	end
end)

This is the remote event handler. located in replicated storage

local rs = script.Parent
local event = rs:WaitForChild("PlayAnim")

event.OnServerEvent:Connect(function(plr,anim,sound)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local hum = char:WaitForChild("Humanoid")
	local animtrack = hum:LoadAnimation(anim)
	
	animtrack:Play()
	sound:Play()
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

There are a few things that could be going wrong here:
a. The animation might not be trusted for your place.
b. You are using the client to send possibly client-sided instances to the server.
c. You are using hum:LoadAnimation(anim) rather than hum.AnimationController:LoadAnimation(anim)

Make sure to check output for errors.

I cannot fully assess the extent of your problem without seeing the explorer. It would be best if you could attach a photo of your animation on the server.

Hello

-This is a place without collaboration mode place and im using an animation made by me.
-Correct me if i did something wrong but i entered the server in testing mode and loaded the animation with command executor this is the code

 local char = workspace.byrongamer90 local hum = char.Humanoid local playemote = char.PlayEmote local folder = playemote.CurrentEmote local anim = folder.Animation local animtrack = hum:LoadAnimation(anim) animtrack:Play()

-Thank you for showing me another option to load animations its just the old habits, still LoadAnimation still works.

Heres the full output after pressing g.
image

Here’s the other images u requested
image

image

2 Likes