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

Anti Reset Script Help?

Asked by
22To 70
8 years ago

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)
0
game:service'Players'.Name = 'Something' -- This breaks a ton of crap lol CodingEvolution 490 — 8y

2 answers

Log in to vote
1
Answered by
drew1017 330 Moderation Voter
8 years ago

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)
0
When I Press Reset the character still Resets? 22To 70 — 8y
0
You cant use WaitForChild in the player for find the character XToonLinkX123 580 — 8y
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 XToonLinkX123 580 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

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)
0
it works but it stops the animation of the player? 22To 70 — 8y
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 aquathorn321 858 — 8y

Answer this question