Play Solo: Player and Character have different names

It has always(?) been the case that the player in Play Solo was called Player1, but I noticed today that that had changed to be my actual username ‘MasterDaniel’.

However, whilst game.Players shows ‘MasterDaniel’ as a player, my character in workspace is called ‘Player1’, breaking many parts of my game when I’m testing in studio.

EDITS

  • Its something to do with either CharacterAutoLoads or LoadCharacter
  • Its solved by adding a wait() after PlayerAdded.

This code can be used to reproduce the bug

local Players = game:GetService("Players")
Players.CharacterAutoLoads = false

Players.PlayerAdded:connect(function(Player)
	Player.CharacterAdded:connect(function(Character)
		local Humanoid = Character:FindFirstChild("Humanoid")
		if Humanoid then
			Humanoid.Died:connect(function()
						Player:LoadCharacter()	
			end)
		end
	end)
	Player:LoadCharacter() 
end)

EDIT 27/08
So this was supposedly fixed, but the following code, originally posted in #10 still results in the error. Its nothing to do with LoadCharacter as I first thought.

game.Players.PlayerAdded:connect(function(Player)
	print(Player.Name)
end)
4 Likes

Not having this issue in a new place or published places:

Title fixed :stuck_out_tongue:

Hmm, strange. I was fiddling about with some code in my game before I found this; but none of it changes the characters/players name.

Do you use custom characters or StarterCharacter? Does it happen on an empty baseplate?

Nope, nope and nope. Although it is also happening in a previous version of the game (I originally observed this issue on my test server) which has not been changed at all and it was previously 100% working.

I’ve checked my other games and they seem to be working ok. Very odd. Not sure whether this is my bug or not now :confused:

Looks like some of my code has gone rogue. When I delete all code from my game the problem doesn’t present itself.

Whats interesting though is what I said before: This bug affects the other version of my game but never used to (and I haven’t changed it since it worked).

I’ll start re-adding code to see what breaks it (I have a hunch)

OK I’ve found the bug. Its in a script that deals with “CharacterAutoLoads” and “LoadCharacter” which may, or may not be the problem.

I’m not sure how this code is resulting in the observed bug.

local Players = game:GetService("Players")
Players.CharacterAutoLoads = false

Players.PlayerAdded:connect(function(Player)
	Player.CharacterAdded:connect(function(Character)
		local Humanoid = Character:FindFirstChild("Humanoid")
		if Humanoid then
			Humanoid.Died:connect(function()
						Player:LoadCharacter()	
			end)
		end
	end)
	Player:LoadCharacter() 
end)
2 Likes

Was able to reproduce with that code (after removing the require) in a new place: after the character resets everything is fine, but the first time I spawn in my character is named Player1 and its appearance doesn’t load either, so I wonder if it’s something along the lines of LoadCharacter not being entirely ready when you call it so soon. @Osyris was working with LoadCharacter for R15 purposes recently, so he may be familiar with it enough to shed insight on what’s happening.

Added this to the bug list. Thanks for the help tracking this one down!

4 Likes

I have some more information that may or may not be related to the above problem.

Pasting this into an empty baseplate will print “Player1” despite the fact my username in both the workspace and game.Players is “MasterDaniel”.

game.Players.PlayerAdded:connect(function(Player)
	print(Player.Name)
end)

Making the function yield with wait() after it fires solves this problem.

This has now been fixed, confirmed by the new changelog :smiley:

blob.png

So initially I thought this fixed my problem but it didn’t. The character in the workspace is still called “Player1” when I’m called MasterDaniel. :confused:

Has this fix been released yet? / am I misinterpreting the bug which has been fixed? cc @UristMcSparks @Silent137

Hmm, it’s fixed for me! That’s strange?!

I just attempted the easiest repro that I posted above… and for me it is still broken.

game.Players.PlayerAdded:connect(function(Player)
	print(Player.Name)
end)

Printing that prints “Player1” for me.
Without that script, my character in the workspace is called “MasterDaniel”.
When that script is added, my character is called “Player1”

@MasterDaniel are you still experiencing the issue? Thank you.

1 Like

Looks like it is all sorted now :smiley:
I removed the wait() that kept everything working and my Player and Character are both now called ‘Player1’

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