Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Anti Reset Script Help?

Ok So I tried to change the name of the Humanoid using this but it wont work?

game.Players.PlayerAdded:connect(function(plr)
	Humanoid.Name="Human"
end)

1 comment

0

game:service'Players'.Name = 'Something' -- This breaks a ton of crap lol

2 answers

The game doesn't know what Humanoid you're talking about, since you didn't write a path to it.

game.Players.PlayerAdded:connect(function(plr)
    plr.Character.Humanoid.Name="Human"
end)

However, due to how Roblox's object loading system works, when this code runs the player's Character may not exist yet, leading to an error, so we should throw in a Wait For Child to wait until it does exist to avoid errors:

game.Players.PlayerAdded:connect(function(plr)
    plr:WaitForChild("Character").Humanoid.Name="Human"
end)

3 comments

0

When I Press Reset the character still Resets?

0

You cant use WaitForChild in the player for find the character

0

Actually, you can but the rest of your code will not run because it waitting the child "Character" in the player and it's nil

You weren't referencing the Humanoid correctly, you need to search for it inside the character. You should t use character added for this, so the code runs whenever the character spawns, rather than just once.

game.Players.PlayerAdded:connect(function(player)--whenever a player joins the game, run the following code and return the player
	player.CharacterAdded:connect(function(character)--whenever a character tailored to the given player spawns, run the following code and return the character
		character:FindFirstChild("Humanoid").Name = "Human"--search for the humanoid inside the given character and rename it "Human"
	end)
end)

2 comments

0

it works but it stops the animation of the player?

0

The player script that does the animating references the humanoid in the player by it's name, so yeah, it interferes with other scripts if you rename the humanoid

This discussion is preserved as it was. New answers, comments, and votes are closed.