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

Humanoid isn't acting as it should (changing state and health) with my ModuleScript?

Asked by 3 years ago
Edited 3 years ago

I have tried using WaitForChild and Variables to refer to my Humanoid, it is being found and not some bs error, it can be printed and can have values read. The thing is: Humanoid:ChangeState() and changing health with Humanoid:TakeDamage() wont do anything.

Here's a snippet of my revival code.

function ReviveModule.Revive(Character)
    local Humanoid = Character.Humanoid
    Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
    for i=Humanoid.Health,Humanoid.MaxHealth,1 do
        wait()
        Humanoid:TakeDamage(-1)
    end
    print(Humanoid.Name.. " revived successfully!")
end

I've tried it with a LocalScript before (exact same method) and it works as expected. Is it something to do with it not being local?

EDIT: Testing with a WaitForChild() instead of indexing the humanoid directly also does not work It still prints the "Humanoid revived successfully!" message.

Answer this question