So I have this nice emotes system which works pretty well. Though for an upcoming update, I decided to make dual emotes (emotes that you can do with another player), and so I coded it. When tested, the first player (aka the initiator) gets the animation., yet the second one doesn’t.
ServerScript (only important snippets):
while task.wait(1) do
counter -= 1
if counter > 0 then
setPrompt.Triggered:Connect(function(trigger)
if player.Name == trigger.Name then
else
trigger.Character.HumanoidRootPart.CFrame = facePart.CFrame
trigger.Character.Humanoid.WalkSpeed = 0
trigger.Character.Humanoid.AutoRotate = false
relayEvent:FireClient(player, "Player1") --This one works.
relayEvent:FireClient(trigger, "Player2") --This one doesn't?
setPrompt:Destroy()
end
end)
elseif counter <= 0 then
for i, parts in pairs(char:GetChildren()) do
if parts.Name == "FacePart" then
parts:Destroy()
end
end
for i, prompts in pairs(char.Torso:GetChildren()) do
if prompts:IsA("ProximityPrompt") then
prompts:Destroy()
end
end
char.Humanoid.WalkSpeed = 16
char.Humanoid.AutoRotate = true
counter = 5
break
end
end
LocalScript (only important snippets):
grpEmote:FireServer(emoteN)
local dualCheck = dualEmotes:GetChildren()
relayEvent.OnClientEvent:Connect(function(who)
print(who) --only prints for Player1, never Player2
if who == "Player1" then
loadedAnim:Play()
elseif who == "Player2" then
local newEmoteN = string.gsub(emoteN, " 2P", "")
print(newEmoteN)
for i, nameAnim in pairs(dualCheck) do
if nameAnim.Name == newEmoteN and nameAnim:IsA("Animation") then
local dualAnim = char:WaitForChild("Humanoid"):LoadAnimation(nameAnim)
Player.Character:WaitForChild("Humanoid").AutoRotate = false
Player.Character:WaitForChild("Humanoid").WalkSpeed = 0
dualAnim:Play()
end
end
end
end)
It’s supposed to work, yet I do not know what’s wrong. I’ve searched a lot about topics relating to this, to no avail. Any help is appreciated! Let me know if you want access to the full script.