This keeps happening

I am making an Among Us-like game, and trying to make a chat system where it can get a Player’s UserId or Display name although the Output says it attempted to index nil… there is no way you can use a quote-unquote “GetProperty” function or whatever…

local Players = game:GetService('Players')
local player = Players.LocalPlayer

local Message = script.Parent
local DisplayName = Message.DisplayName
local Username = Message.Username

DisplayName.Text = player.DisplayName
Username.Text = '@' .. player.Name

1 Like

You also need to give us the script you’re using. Otherwise this post makes no sense…

1 Like

it seems your trying to do something along the lines of player:GetProperty() which is a function that does not exist, unless its saying that for no reason which i wouldnt assume

all you have to do to get a players userid or display name is just to have a variable set to a player preferably to the event they join at aka game.Players.PlayerAdded:Connect(function(player)

then just do like player.UserId or player.DisplayName
and if you print one of those values, it will return it, but im assuming you want to do something else with it

I used the PlayerAdded() function in my script, there is no error in output, although it still won’t show the Name/Image.

is this a server or local script?

local script I assume, or else they wouldn’t be able to get the localplayer

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.