#Whats the best way to handle two player emotes?
1 messages · Page 1 of 1 (latest)
i check if the emote has 2 player allowed onto it via this:
if TwoPlayer and TwoPlayer["2Player"].Value == true then
TwoPlayerRemote:FireServer("Request", emoteName)
end
And fires a request to the server making a prox prompt.
and then when the prompt is trigger this fires it to both clients
TwoPlayerRemote:FireClient(requestingPlayer, "Yourself", emoteName, targetPlayer)
TwoPlayerRemote:FireClient(targetPlayer, "Partner", emoteName, requestingPlayer)
which then goes into the module and does this:
TwoPlayerRemote.OnClientEvent:Connect(function(role, emoteName, otherPlayer, syncPos)
if role == "DelPrompt" then
local EmotePrompt = Character.HumanoidRootPart:FindFirstChild("EmotePrompt")
if not EmotePrompt then return end;
EmotePrompt:Destroy()
return
end
local anim = script.Emotes:FindFirstChild(emoteName)
if not anim then return end
local twoP = anim:FindFirstChild("TwoPlayer")
if not twoP then return end
local subAnim = twoP:FindFirstChild(role)
if subAnim then
EmoteController._playSubAnimation(subAnim, role, otherPlayer, syncPos)
return
end
end)
- Ask server to do emote
- Server freezes players
- Server moves players into proper position for animation
- Server plays animation
- Server unfreezes players
so opposite on how it plays the first animation? i see i see
Because it has to sync two players animating together, doing it server side makes more sense
Single player emotes make sense doing them client side since animation automatically replicates