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

Renaming a players humanoid causing animations to no longer run?

Asked by 9 years ago

The way I've always known about disabling a players ability to reset their character is through renaming their humanoid. Usually this is a perfectly fine method of doing so, except now it seems that it is causing the characters default animations to no longer work after the character respawns once. This is the code in a local script inside of StarterPlayerScripts

local player=game.Players.LocalPlayer
function onCharacter(char)
    char:WaitForChild("Humanoid").Name="humanoid"
end
if player.Character then
    onCharacter(player.Character)
end
player.Changed:connect(function(prop)
    if prop=="Character" and player.Character then
        onCharacter(player.Character)
    end 
end)

1 answer

Log in to vote
0
Answered by 9 years ago

The animations must be loaded to the Humanoid in order to work. The Animate script looks for an object called "Humanoid", so when you rename it to "humanoid", the Animate script can no longer find an object called "Humanoid", thus causing the script to fail.

TL;DR the Animate script in a player can't find a humanoid.

EDIT: To fix this you're going to have to delete the player's current animation script(not putting it in since it's 500+ lines long) and replace it with a new one where line 17 is

local Humanoid = waitForChild(Figure, "humanoid")

So yes, you have to delete the entire script and reload it with a one character change.

Ad

Answer this question