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

NPC Animation Help Disabling When Cloned From ReplicatedStorage?

Asked by 6 years ago
Edited 6 years ago

Hello, everyone.

I'm having trouble with NPC animations and tried some things such as just a script inside the CustomCharacter that will play the loaded idle animation and when I start a server, the character is inaminate. This is the one:

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 can't seem to find an answer as to why the first one isn't working. FE is enabled and the NPC's HumanoidRootPart isn't locked. So, I'm trying a Local script within the Starterpack that after cloning the Character from ReplicatedStorage into the current camera it will disable the Animation script inside the NPC. Here is that script:

repeat wait() until game.Workspace.CurrentCamera
local camera = game.Workspace.CurrentCamera

local character = game:GetService('ReplicatedStorage'):WaitForChild('CustomCharacter'):Clone()

local player = game.Players.LocalPlayer

local Hat = player:WaitForChild("Hat")
local Shirt = player:WaitForChild("Shirt")
local Pants = player:WaitForChild("Pants")

character.Parent = camera

local character2 = camera:WaitForChild('CustomCharacter')

character2:WaitForChild('Animation')
character2.Animation.Disabled = false

All recommendations and suggestions are welcome! Thank you, for your time.

Respectfully,

  • sparkevin

Answer this question