Attempt to concatenate string with Instance: What instance?

So here I have a basic script, which I’m not using for anything. I’m simply testing it out.

local name = game.Players.LocalPlayer

print("Name is "..name)

It basically prints the local player.

Whenever I use this script, I get the “attempt to concatenate string with Instance” error.

What’s stumping me is that if I use print(name) instead of print("Name is "..name), it works just fine.

Any feedback would be constructive. Thank you!

1 Like

Because name points to the player instance itself. Don’t use misleading names, that is why you got confused.

local Players = game:GetService("Players")

local client = Players.LocalPlayer -- player works fine too in place of client

print("Name is " .. client.Name)
2 Likes

try using tostring()

local client = game.Players.LocalPlayer

print("Name is "..tostring(client.Name))
2 Likes