Hey im trying to do a sync system but it always return that weird error anyway to fix?
local Players = game:GetService("Players")
local ids = {}
for i,v in ipairs(game.ReplicatedStorage.Animations:GetChildren()) do
table.insert(ids, v.AnimationId)
end
game.ReplicatedStorage.SyncDance.OnServerInvoke(plr,victim : Player)
if victim == plr then return end
if victim == nil then
local humanoid = plr.Character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local AnimationTracks = animator:GetPlayingAnimationTracks()
for _,v in ipairs(AnimationTracks) do
v:Stop()
end
return
end
if victim.Parent == game.Players then
local subject = victim
if subject then
local humanoid = plr.Character:WaitForChild("Humanoid")
local humanoid2 = subject.Character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local animator2 = humanoid2:WaitForChild("Animator")
local AnimationTracks = animator2:GetPlayingAnimationTracks()
local AnimTracks= animator:GetPlayingAnimationTracks()
for _,v in ipairs(AnimTracks) do
v:Stop()
end
for _, v in ipairs(AnimationTracks) do
if table.find(ids, v.AnimationId) then
--print(v)
local track = animator:LoadAnimation(v.Animation)
track.Priority = Enum.AnimationPriority.Action
track:Play()
track.TimePosition = v.TimePosition
track:AdjustSpeed(v.Speed)
end
end
end
end
end