game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if string.sub(msg, 1, 5) == "/sync" then
local subjectt = string.sub(msg, 7)
local subhumanoid = subjectt.Character.Humanoid
local plrhumanoid = plr.Character.Humanoid
local animtrack = subhumanoid:GetPlayingAnimationTracks()
for i, track in pairs(animtrack) do
local animationobject = track.Animation
local play = plrhumanoid:LoadAnimation(animationobject)
local play2 = subhumanoid:LoadAnimation(animationobject)
play:Play(0.25)
play2:Play(0.25)
end
end
end)
end)
7: attempt to index nil with ‘Humanoid’
someone help im a bad scripter aaa
Honestly, I find string.split very efficient in cases like this, and admin commands in general as it’s so easy to understand, here’s an example:
local Players = game:GetService('Players')
local Prefix = '/'
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
local Splits = Message:split(' ')
local Arg1 = Splits[1]
local Arg2 = Splits[2]
if Arg1:lower() == Prefix .. 'sync' and Arg2 then
local GetPlayers = Players:GetPlayers()
for i = 1, #GetPlayers do
local Target = GetPlayers[i]
if Target.Name:sub(1, #Arg2):lower() == Arg2:lower() then
local Character = Target.Character
if Character then
local Humanoid = Character:FindFirstChild('Humanoid')
if Humanoid then
-- Play the animation stuff.
end
end
end
end
end
end)
end)