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

Why is it saying thsi? Attempt to index nil with name

Asked by 4 years ago
Edited 4 years ago
script.Parent.Text = "Welcome" .. game.Players.LocalPlayer.Name.. "!"

Why wont it put the players name it just says nil

0
is it a local script or a regular script SoftlockedUnderZero 668 — 4y
0
Regular JessHi0 0 — 4y
0
Use a localscript! R_LabradorRetriever 198 — 4y
0
Regular scripts, or formally "ServerScripts", are run on ROBLOX's Servers out in San Mateo, California. A LocalScript is operated on the Local Machine—Client (Your computer)—with the Roblox Player application. The LocalScript can only understand who the LocalPlayer is as it knows which Client it's running on. The Server cannot contain a LocalPlayer either as it is isn't a Player, but a machine man Ziffixture 6913 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

Use a localscript, as game.Players.LocalPlayer can only be accessed that way! Also, I recommend changing "Welcome" to "Welcome, "

Ad
Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

You do not need to reference the local player because your not setting any properties in a local scripts like characters,tools etc to fix this do.

NOTE: Make sure it's server sided

game.Players.PlayerAdded:Connect(function(player)
    print("A player has entered: " .. player.Name)
end)
0
I'm going to assume that the welcome message is only supposed to show up for the player it's welcoming, so I think it should be swapped with a Local Script instead. lunatic5 409 — 4y

Answer this question