So I am trying to load the player when the map changes, when the map changes it deletes the player and respawns it. For some reason roblox thinks the character exists but its not appearing! Please help me fix this.
Are you using this in a local script? I noticed the âplrâ variable, and it is not defined in that event.
If itâs a server script, avoid defining multiple events for each player. Just loop through the players every time it changes.
Again, LoadCharacter only works in server, and no need to set the character parent!
Adding to what @RafaelFixe1 said, you also need to set the cframe of the playerâs character after you load it.
Its not even appearing in the workspace, its not a local script because right above that code its in a game.players.playeradded function
can you post the entire code the snippet provided is very vague
I will once roblox is back up lol
Hey dude, uhm the current code logic you have shouldnât have flaws in its performance. Itâs probably an issue with how this script is interacting with the system you set it up with.
To debug, I suggest adding a print statement on line 5 (right after the MapLoaded Value changes) to see when this event fires. You want the value to fire true
when the map is loaded, and stay true until youâre done with the map.
print('Fired with value: '..tostring(workspace.ServerSettings.MapLoaded.Value))
If this part isnât getting printed, then youâre never getting to the code to spawn the player. If you are getting this printed out, then make sure your if statements match with the possible values they could be. For example true ~= âtrueâ, so make sure MapLoaded is a BoolValue.
One other thing to note, after a character has been loaded, player.Character will always exist.
Place your code in code blocks visit here About the Scripting Support category to see how to do that.
The map gets added, I see it in the workspace. The issue is the player. The player isnt being added to the workspace yet when I print the localplayers characters name the character isnt nill. Its super strange. I am going to try what greatgavin said