How can I get user name in plugin?

Is it possible to get username with out pushing Test button in plugin?
what I want to make is welcome back print that will print when user get into studio like this:
“[Plugin] Welcome back! username!”

1 Like

Try:

local name = game.Players.LocalPlayer.Name

Try this in teamcreate studio and ‘non-teamcreate’.

I want it to do it in single create studio and that didn’t work

user_test.lua.Script:4: attempt to index nil with ‘Name’ - Edit

I found how, using StudioService

local playerId = game:GetService("StudioService"):GetUserId() --this gets current studio user's userId
print("[Plugin] Welcome back! " .. game:GetService("Players"):GetNameFromUserIdAsync(playerId) .. "!") --gets player name from userId and print message
12 Likes