Humanoid.DisplayName not setting. What's the deal?

Alright, I’m trying to work on a story game similar to that one PARTY.exe game, and so far the dialog system (changing the displayname of the humanoid) is just not working for me.

this is the script i currently have
image note that it prints out the variables


But also note that it’s just not changing from “test” to “I love among us!” Please don’t ask why I made the voice say that, it’s just a debug thing I use.

Am I just missing something in DisplayName? Should I choose a different solution for this? help.

You set a variable to be “I love among us!”, not the property, you have to reference the property itself, so script.Parent.Parent.Humanoid.DisplayName = voice1

Shouldn’t “text” (the variable at the top) in this scenario be referencing the DisplayName already? Otherwise it wouldn’t be printing what it actually is (that being “test” as seen in the image.)

i’ll try your idea and see if it works though

edit 1 - ok so-

I did the idea and it worked. As kinda clunky as it is, it works I guess.

It returns a string that means you’re trying to do something like (I think):

"test" = "I love among us!"

just do what @EmbatTheHybrid says

No it doesn’t, in this case text contains the value in DisplayName at the time the line was reached. so if the displayname was Bob, the text variable will contain Bob, not a reference to the DisplayName property, when you update text, it’ll only update the variable, not the property

ohhhhhhhhhhhhhhhhhhhhhhhhhhhh

How do i reference it then? Without writing the entire script.Parent.Parent.Humanoid.DisplayName thing, which i’ve changed into script.Parent.DisplayName, because it works the same thing, i was just making sure originally.

You reference like how you did to put it in a variable, any time you want to change the DisplayName, just reference the property of the object

script.Parent.DisplayName = "new value"

If you plan on doing this many times, put script.Parent in a variable

1 Like