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

NPC Animate Server Script Only Works In Studio?

Asked by 6 years ago

Hello, fellow scripters.

It seems like the NPC animate script is a topic that is continually being dismissed. I've posted questions before about it, but it seems like it's something maybe out our capabilites, as well as ROBLOX's. The original server script that i have for my NPC that refuses to comply with during an online server is simply the regular character r15 animation within the Player rig, replaced with a server script instead of the orginal LocalScript due to the player being NPC, and the chat emotes are muted because that only pertains to an actual Player.

This is another basic NPC animation server script I've developed that works proficiently as well in Studio, but refuses to work also during online mode:

local char = script.Parent --the npc
local hum = char:WaitForChild('Humanoid') --the npc's humanoid
local animation1b = script:WaitForChild('Animation1')
local animation2b = script:WaitForChild('Animation2')
local animation1 = hum:LoadAnimation(animation1b) --finds the animation inside the script and loads it in the npc's humanoid
local animation2 = hum:LoadAnimation(animation2b)

if char and animation1 and animation2 then --this just checks if the npc exists
    while true do
    animation2:Play() --plays the animation
    wait(4.5)
    animation2:Stop()
    animation1:Play()
    wait(8)
    animation1:Stop()
    animation2:Play()
    wait(4.5)
    animation2:Stop()
    animation1:Play()
    wait(8)
    animation1:Stop()
    end
end

I am more than welcome to any ideas, suggestions & recommendations! Thank you, for your time. I really appreciate any effort and/or future work from you.

Respectfully,

  • sparkevin
0
What is your error output? NexoKami 12 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Thaats confusing.

I created this script for a game I'm currently working on, and it works smoothly and effortlessly. I would help you, but I honestly am kind of stumped as to what the problem could be.

local idle = script:WaitForChild('idle')
local humanoid = script.Parent:WaitForChild('Humanoid')
local idleanimload = humanoid:LoadAnimation(idle)
idleanimload:Play()

Are there any errors? Have you tried using print() to find out where the script stops?

Ad

Answer this question