Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

idk whats wrong the animation wont play no error at all how do i fix?

the model i made:
https://www.roblox.com/library/3366141443/attacker

local torso = script.Parent.HumanoidRootPart
local h = script.Parent.Humanoid
local spawnCF = script.Parent.HumanoidRootPart.CFrame
local anim = h:LoadAnimation(script.Parent.Tool.Animation)
local att = false
function findplayer()
 for _,v in next,game.Players:GetPlayers()do
  if v.Character then
   local char = v.Character
   if char:FindFirstChild("Humanoid")and char:FindFirstChild("HumanoidRootPart") then
    local ptorso = char.HumanoidRootPart
if(ptorso.position - torso.Position).magnitude <= 7 then
    att = true
end
    if(ptorso.position - torso.Position).magnitude <= 27 then
   return v
    end
   end
  end
 end
 return nil
end

while wait()do
 local player = findplayer()
 if player ~= nil then
      h:MoveTo(player.Character.HumanoidRootPart.position)
if att == true then
    anim:Play()
    wait(.8)
    att = false
end
else
 h:MoveTo(spawnCF.p)
 end
end

1 answer

Raise the priority of your animation, it's most likely set to Core.

1 comment

0

did not work

This discussion is preserved as it was. New answers, comments, and votes are closed.