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

Humanoid always falls when Unanchored?

Asked by 5 years ago
Edited 5 years ago

I have a zombie which is anchored when spawned, but after 3 seconds it gets unanchored and just falls down. I want the zombie to instantly start walking when he gets unanchored. I am trying to make an animation, where a zombie comes up from the ground, like in the game Zombie Attack. This is the code I have now:

function SpawnZombie()
    local zombieTorso = script.Parent.HumanoidRootPart

    --zombieTorso.Anchored = true
    script.Parent.Torso.CanCollide = false
    script.Parent["Left Leg"].CanCollide = false
    script.Parent["Right Leg"].CanCollide = false

    for i = -5.5, 4.5 do
        zombieTorso.CFrame = CFrame.new(zombieTorso.Position.x, i, zombieTorso.Position.y)
        wait(0.1)
    end

    --zombieTorso.Anchored = false
    script.Parent.Torso.CanCollide = false
    script.Parent["Left Leg"].CanCollide = true
    script.Parent["Right Leg"].CanCollide = true

    zombie:MoveTo(Vector3.new(0, 0, 0))
end

2 answers

Log in to vote
0
Answered by
piRadians 297 Moderation Voter
5 years ago
Edited 5 years ago

Make sure the CanCollide Property is set to true in each part of the zombie.

Also, to make any humanoid walk, you would to use the MoveTo function of Model.

Model:MoveTo(positionwhereyouwanthimtomove)
0
I know how to make it walk, but after I unanchor the zombie it just falls down and after a few seconds starts to walk Francisl4d45 7 — 5y
0
If the CanCollide property is set to true, then i'd recommend sending your code in the question. piRadians 297 — 5y
0
Have you tried placing the zombie in the ground? piRadians 297 — 5y
View all comments (5 more)
0
Yes, the zombie always falls down. Francisl4d45 7 — 5y
0
Maybe it's the code then, I don't know, since I can't see the code. piRadians 297 — 5y
0
You can check the code now. Francisl4d45 7 — 5y
0
Can we see the whole script? Pojoto 329 — 5y
0
There is nothing else that controls the zombie in the script Francisl4d45 7 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Try using a Weld Script.

Answer this question