Im trying to adjust the animtrack speed in this loop and it isnt quite working as intended and erroring
for idx,enemy in pairs(EnemF:GetChildren()) do
if (enemy.PrimaryPart.Position - hurmp.Position).Magnitude <= 8 then
local enemyhum = enemy:WaitForChild("Humanoid")
local tracks = enemyhum:GetPlayingAnimationTracks()
for i,v in pairs(tracks) do
if table.find(EnemyAttacks, v.Name) then
tracks:AdjustSpeed(2)
end
end
end
end
Thatβs not the issue, the function call is likely pointing to line 34 where the error occurs. The output window just lets you know that it was that function call that procβd the error.
Iβm not sure which line is 34, but if it is the one with hurmp.Position itβs likely that whatever hurmp is, it isnβt loaded yet or doesnβt exist.
remote.OnServerEvent:Connect(function(plr, combat)
local char = plr.Character
local hurmp = char:WaitForChild("HumanoidRootPart")
-- Functions
local function SS()
for idx,enemy in pairs(EnemF:GetChildren()) do
if (enemy.PrimaryPart.Position - hurmp.Position).Magnitude <= 8 then
local enemyhum = enemy:WaitForChild("Humanoid")
local tracks = enemyhum:GetPlayingAnimationTracks()
for i,v in ipairs(tracks) do
if table.find(EnemyAttacks, v.Name) then
tracks:AdjustSpeed(2)
end
end
end
end
end
if combat then
print("Binded!")
SpiderLoop = runs.Heartbeat:Connect(function()
SS()
end)
else
print("Unbinded!")
SpiderLoop:Disconnect()
end
end)