Im trying to make a sync animation for players, where 1 player can sync his animation to the other player. Im facing an issue, I can’t detect which animation (that the other player is playing) is the dance animation. Is there a way to give the animations that get loaded a name and not just keep it animation?
I tried changing:
v.Name = "emote"
Humanoid:Loadanimation(v)```
but it didnt work.
Sync source code: (SERVER SCRIPT)
```lua
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local players_tbl = {}
local sync_pattern = "/sync ([%w_]+)"
local unsync_command = "/unsync"
local function sync(player, target)
local animator1 = player.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local animator2 = target.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
for i,v in pairs(animator2:GetPlayingAnimationTracks()) do
print("Name: ",v.Name,"Speed: ",v.Speed,"Attribute: ",v:GetAttribute("Emote"))
end
end
RS.Sync.OnServerEvent:Connect(function(player, target)
if target and target:IsA("Player") then
local now = tick()
local LastUsed = players_tbl[player] or 0
if now - LastUsed > 3 then
players_tbl[player] = now
sync(player,target)
end
end
for i,v in pairs(players_tbl) do
print(i , ":", v)
end
end)
Source code of animation loading: (LOCAL SCRIPT)
v.Name = "Emote"
local loadedAnim = humanoid:WaitForChild("Animator"):LoadAnimation(v)
loadedAnim:SetAttribute("Emote",true)
loadedAnim.Looped = true
loadedAnim.Priority = Enum.AnimationPriority.Action
All help is appreciated!