I've been animating enemies for my game recently and I've had a good base with a model I've been using, but there are some serious problems. The enemy works almost perfectly in studio (however if I put two or more, they attack each other which needs to be fixed) but is completely broken in-game. It will still chase players and attack them, but the animations don't work and some actions cause it to break.
The model itself has too many scripts for me to post here. However, the link leads to the model and can be opened up in studio to be dug into. Any suggestions?
http://www.roblox.com/Drooling-Zombie-item?id=187789986
Basic Script~
local zombie = script.Parent for _, script in pairs(zombie.ModuleScripts:GetChildren()) do if not game.ServerStorage:FindFirstChild(script.Name) then script:Clone().Parent = game.ServerStorage end end local AI = require(game.ServerStorage.ROBLOX_ZombieAI).new(zombie) local DestroyService = require(game.ServerStorage.ROBLOX_DestroyService) local function clearParts(parent) for _, part in pairs(parent:GetChildren()) do clearParts(part) end local delay if parent:IsA("Part") then delay = math.random(5,10) else delay = 11 end DestroyService:AddItem(parent, delay) end zombie.Humanoid.Died:connect(function() AI.Stop() math.randomseed(tick()) clearParts(zombie) script.Disabled = true end) local lastMoan = os.time() math.randomseed(os.time()) while true do local animationTrack = zombie.Humanoid:LoadAnimation(zombie.Animations.Arms) animationTrack:Play() -- local now = os.time() -- if now - lastMoan > 5 then -- if math.random() > .3 then -- zombie.Moan:Play() ---- print("playing moan") -- lastMoan = now -- end -- end wait(2) end
If it isn't animating online then it's because the animation wasn't uploaded. You need to upload the animation before you can use it online.
http://wiki.roblox.com/index.php?title=Animations#Using_Animation_in_Games