player.Name somehow doesn't work while there is a local player = game.Players.LocalPlayer

So I was scripting a game while I wanted a player’s name to be put in a print command so I went to the top where I put all my locals and added: local player = game.Players.LocalPlayer
then I went down and wrote: print("Checking if"player.Name"Has regular NPC dialogue settings") And then I noticed that the player.Name was underlined with red meaning that there is an error with it, And I do not understand why it is giving me an error it should work because as I said, At the top I wrote: local player = game.Players.LocalPlayer. I don’t need this feature only for the print command, I also need it for other things because if I need it for the print command only, It would just be a waste of time. (I used a local script.)
This is what was in the LocalScript:
local part = workspace.TalkPart1
local textlabel = script.Parent.Frame.TextLabel
local CloseBtn = script.Parent.Frame.CloseBtn
local ContinueBtn = script.Parent.Frame.ContinueBtn
local player = game.Players.LocalPlayer
local PlayerCancelledDialogue = print(“A Player has Cancelled their NPC Conversation.”)
local PlayerContinuedDialogue = print(“A Player has Continued their NPC Conversation.”)

part.ClickDetector.MouseClick:Connect(function()
script.Parent.Frame.Visible = true

wait(0.2)
textlabel.TextScaled = true
textlabel.Text = “H”
wait(0.1)
textlabel.Text = “He”
wait(0.1)
textlabel.Text = “Hey”
wait(0.1)
textlabel.Text = "Hey "
wait(0.1)
textlabel.Text = “Hey T”
wait(0.1)
textlabel.Text = “Hey Th”
wait(0.1)
textlabel.Text = “Hey The”
wait(0.1)
textlabel.Text = “Hey Ther”
wait(0.1)
textlabel.Text = “Hey There”
wait(0.1)
textlabel.Text = “Hey There!”
wait(0.1)
textlabel.Text = "Hey There! "
wait(0.1)
textlabel.Text = “Hey There! Y”
wait(0.1)
textlabel.Text = “Hey There! Yo”
wait(0.1)
textlabel.Text = “Hey There! You”
wait(0.1)
textlabel.Text = “Hey There! You M”
wait(0.1)
textlabel.Text = “Hey There! You Mi”
wait(0.1)
textlabel.Text = “Hey There! You Mig”
wait(0.1)
textlabel.Text = “Hey There! You Migh”
wait(0.1)
textlabel.Text = “Hey There! You Might”
wait(0.1)
textlabel.Text = “Hey There! You Might”
wait(0.1)
textlabel.Text = “Hey There! You Might n”
wait(0.1)
textlabel.Text = “Hey There! You Might no”
wait(0.1)
textlabel.Text = “Hey There! You Might not”
wait(0.1)
textlabel.Text = "Hey There! You Might not "
wait(0.1)
textlabel.Text = “Hey There! You Might not k”
wait(0.1)
textlabel.Text = “Hey There! You Might not kn”
wait(0.1)
textlabel.Text = “Hey There! You Might not kno”
wait(0.1)
textlabel.Text = “Hey There! You Might not know”
wait(0.1)
textlabel.Text = "Hey There! You Might not know "
wait(0.1)
textlabel.Text = “Hey There! You Might not know m”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me,”
wait(0.1)
textlabel.Text = "Hey There! You Might not know me, "
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, B”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, Bu”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But”
wait(0.1)
textlabel.Text = "Hey There! You Might not know me, But "
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I f”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I fo”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I fou”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I foun”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found”
wait(0.1)
textlabel.Text = "Hey There! You Might not know me, But I found "
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found y”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found yo”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you i”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in”
wait(0.1)
textlabel.Text = "Hey There! You Might not know me, But I found you in "
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in t”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in th”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in thi”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this”
wait(0.1)
textlabel.Text = "Hey There! You Might not know me, But I found you in this "
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this c”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this ca”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cav”
wait(0.1)
textlabel.Text = "Hey There! You Might not know me, But I found you in this cave "
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave l”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave ly”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lyi”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lyin”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lying”
wait(0.1)
textlabel.Text = "Hey There! You Might not know me, But I found you in this cave lying "
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lying d”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lying do”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lying dow”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lying down”
wait(0.1)
textlabel.Text = “Hey There! You Might not know me, But I found you in this cave lying down!”
wait(0.1)

wait(3)
print(“Checking if"player.Name"Has regular NPC Dialogue Settings…”)
ContinueBtn.Visible = true
CloseBtn.Visible = true
CloseBtn.MouseButton1Click:Connect(function()
script.Parent.Frame.Visible = false
PlayerCancelledDialogue
end)
ContinueBtn.MouseButton1Click:Connect(function()
PlayerContinuedDialogue
if textlabel.TextScaled == false then
textlabel.TextScaled = true
print(“Error; A Player had their NPC TextLabel settings change from regular.”)
end

textlabel.Text = “I”
wait(0.1)
textlabel.Text = “I’”
wait(0.1)
textlabel.Text = “I’m”
wait(0.1)
textlabel.Text = "I’m "
wait(0.1)
textlabel.Text = “I’m M”
wait(0.1)
textlabel.Text = “I’m Mo”
wait(0.1)
textlabel.Text = “I’m Mor”
wait(0.1)
textlabel.Text = “I’m Morg”
wait(0.1)
textlabel.Text = “I’m Morga”
wait(0.1)
textlabel.Text = “I’m Morgan”
wait(0.1)
textlabel.Text = “I’m Morgan!”
wait(1)
textlabel.Text = “L”
wait(0.1)
textlabel.Text = “Li”
wait(0.1)
textlabel.Text = “Lis”
wait(0.1)
textlabel.Text = “List”
wait(0.1)
textlabel.Text = “Liste”
wait(0.1)
textlabel.Text = “Liste”
wait(0.1)
textlabel.Text = “Listen,”
wait(0.1)
textlabel.Text = “Listen, W”
wait(0.1)
textlabel.Text = “Listen, We”
wait(0.1)
textlabel.Text = "Listen, We "
wait(0.1)
textlabel.Text = “Listen, We d”
wait(0.1)
textlabel.Text = “Listen, We do”
wait(0.1)
textlabel.Text = “Listen, We don”
wait(0.1)
textlabel.Text = “Listen, We don’”
wait(0.1)
textlabel.Text = “Listen, We don’t”
wait(0.1)
textlabel.Text = “Listen, We don’t”
wait(0.1)
textlabel.Text = "Listen, We don’t "
wait(0.1)
textlabel.Text = “Listen, We don’t h”
wait(0.1)
textlabel.Text = “Listen, We don’t ha”
wait(0.1)
textlabel.Text = “Listen, We don’t”
wait(0.1)
textlabel.Text = "Listen, We don’t "
wait(0.1)
textlabel.Text = "Listen, We don’t "
wait(0.1)
print(“SCRIPT WILL BE FINSHED AFTER THE ‘player.Name’ PROBLEM GETS FIXED…”)

end)
end)

Screenshot_34

1 Like

It should be:

("Checking if "..player.Name.." has regular NPC dialogue settings...")
1 Like

You need to separate the arguments, but you aren’t doing that. Just add a comma in between:

print("Checking if", player, "has regular NPC Dialogue Settings...")

Doing player.Name here is redundant since print calls tostring on its arguments and tostring(instance) returns the instance’s name anyway.

Also, please use a for loop, don’t hardcode each new character…

local text = "Hello dude lol"

for i = 1, #text do
    print(text:sub(1, i))
end

Saves you more time.

3 Likes

I tried it, And It does not work.

Do you have any errors in the output?

No, But it doesn’t show the GUI anymore It used to show the GUI before.

So the easy way is replacing it with print("Checking if", player, "has regular NPC Dialogue Settings...)?

Yes. print delimits each argument with a space too.

> print("This", "is", "epic")
This is epic

Alright, Give me a second I will test it.