Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Works in studio but not in game?

Asked by 9 years ago

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
0
Post the script please, I believe I know what the problem is. GreekGodOfMLG 244 — 9y
0
Whatever it is shouldn't have a bunch of scripts. Realistically, every instance of it should be controlled entirely by one script. 1waffle1 2908 — 9y
0
I hope this is what you wanted to see. HurricaneOtto 0 — 9y
0
Is it in a local script? If not put it in it or vice versa. iSvenDerp 233 — 9y
0
I tried local, now they won't even move. So i didn't go through with that. HurricaneOtto 0 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

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

0
The animations are uploaded. I'm starting to consider in-game lag as a culprit perhaps? HurricaneOtto 0 — 9y
Ad

Answer this question