- 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.
- What is the issue? Include screenshots / videos if possible!
The emote and emote sound dont play and dont give any error in the output.
- 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.