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

How do you disable reset OnEnter?

Asked by 10 years ago

I'm making this game and I disabled the coregui but i need to disable reset. I searched to see other questions like this, but each script they gave me didn't work. I edited someone else's script that I was certain would work but, It didn't. I have a localscript named "reset" in the starterpack. Here is the code:

function resetLocalCharacter()
local player = game.Players.LocalPlayer
if player then
if player.Character and player.Character:FindFirstChild("Humanoid") then
player.Character.Humanoid.Name = "humanoid"
end
end
end

Thanks for reading! You can either make another code or edit this one.

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

This function is never actually run, if this is all of the code in that script. As well, this wouldn't likely work on its own due to the assumption that the Humanoid always exists. If you were to enable Filtering, this would not work as a LocalScript.

Here's some working code, let me know if it doesn't work for you:

--This should be a Script (not a LocalScript) in ServerScriptService or as a descendant of the Workspace.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        repeat wait() until character.Parent --WaitForChild errors if `character` is still Parented to `nil`
        character:WaitForChild("Humanoid").Name = "humanoid"
    end)
end)
Ad

Answer this question