How to load the character when they have pressed a button?

I’ve turned off CharacterAutoLoads and I’ve used Player:LoadCharacter but I looked at another post about this and I saw that you cannot load the character if it hasn’t been loaded in the first place so how am I to load the character?

I thought about parenting the character to somewhere like serverstorage and reparenting it to workspace but that didn’t work so now I am properly stuck.

3 Likes

could you please elaborate on

you cannot load the character if it hasn’t been loaded in the first place

1 Like

When the player first joins the game, character auto loads is set to false.

When the player presses a button, it fires a remote event that is supposed to load them but it doesn’t. I researched this further and I saw a person saying that you cannot load the character if it has not been loaded before

I’ve done the same thing before, I had the player not load in, then there would be a play button, when you would click it, it would fire a remote event calling LoadCharacter() on the player, and it worked just fine, maybe the issue is you tried to call loadcharacter() on the players character (ex. workspace.PlayerName:LoadCharacter()) instead of something like game.Players.PlayerName:LoadCharacter() EDIT: I forgot to say that the way i stopped the player’s character from loading was by doing

game.Players.PlayerAdded:Connect(function(plr)
      plr.Character:Destroy()
end)

LocalScript

local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.CharacterLoader:FireServer(Player)

end)

ServerScript

script.Parent.OnServerEvent:Connect(function(Player)
Player:LoadCharacter

end)

This was the script, I’m pretty sure I did everything that you said but it didn’t work.

you’re not calling loadcharacter, you need to put () after loadcharacter

yeah that was a typo on my part but I still did that and it didn’t work

ok, try playtesting, and then send a screenshot of the errors from console (you can open console by typing /console in chat or pressing F9)

literally does nothing, no errors

also when you fire the remote event, you don’t need to fire it with the localplayer because the first argument the server receives is player, then the second argument would be what you’re firing it with, so even if you just fire it without a argument it’ll know who fired it

i found out the issue, scripts can’t run in replicated storage, yet the parent of the script is in replicatedstorage, so the serverscript never runs, so put it in serverscriptservice and replace script.Parent with game.ReplicatedStorage.CharacterLoader

1 Like