:LoadCharacter() not working

Just a reminder, I have found solutions on Google, and they say to make a local script fire a RemoteEvent to a server, to then run :LoadCharacter(), but for some annoying reason it doesn’t work:

Client:

local RS = game:GetService("ReplicatedStorage")

local RSEvents = RS:WaitForChild("Events")
local EventsL = RSEvents:WaitForChild("Loaded")

local player = game.Players.LocalPlayer

local camera = workspace.CurrentCamera

EventsL:FireServer()

Server:

EventsL.OnServerEvent:Connect(function(player)
	
	player:LoadCharacter()
	
end)

This is quite literally meant to work. It fires the RemoteEvent immediately after joining the game, and it’s meant to then load the character in that RemoteEvent. What the hell is wrong?!

If you have any suggestions or solutions, please reply down below. Thank you.

3 Likes

Why are you trying to load the player’s character right after they join the game? Doesn’t that happen automatically?

1 Like

This is just a template I sent on the post, there’s meant to be code between:

local camera = workspace.CurrentCamera

--my code

EventsL:FireServer()

So I want things to run before they spawn.

1 Like

You can turn off ‘CharacterAutoLoads’ in the ‘Players’ service.

1 Like

I obviously did that, because the game starts with no character. It just doesn’t load by :LoadCharacter().

I also put print() after the :FireServer() line and it never printed. It’s something in the local script that’s yielding, but it’s not the RemoteEvents with the :WaitForChild().

I also tried running this code in the Roblox Studio console, and it works. Something is definitely yielding.

game.ReplicatedStorage.Events.Loaded:FireServer()
--does work in console

You can LoadCharacter without even using RemoteEvent

Also add some wait time when player joins, because It can cause some errors.

Yes, but I want to make a menu screen, then when you click Play, for instance, it fires the event to then load the character.

I even added a task.wait(5) before the :FireServer() line, nothing.

Try using:

local RS = game:GetService("ReplicatedStorage")

local RSEvents = RS:WaitForChild("Events")
local EventsL = RSEvents:WaitForChild("Loaded")

local player = game.Players.LocalPlayer

local camera = workspace.CurrentCamera

game:GetService("Players").PlayerAdded:Connect(function(plr)
       task.wait(0.5)
       EventsL:FireServer()
end)

This script is in StarterPlayerScripts, there’s no point for an event.

Put the script that receives the event inside of ServerScriptService as a ServerScript
Put the script that sends the event inside of StarterPlayerScripts

I literally did that.
I don’t know what’s happening anymore.

Check that the event is actually being fired i saw that you said your firing the event when pressing a button check the code that detects when you click the button or place a print statement in the server scripts event function to check if it is being ran

Read the comment above.

I did put a print() after the line where the event gets fired, nothing. If this didn’t work, then there was no point putting a print in the server.

i used the code from the original post and it works just fine it is a problem with either where u have placed your scripts or the function that EventsL:FireServer() is being fired in

Something’s wrong with my studio then. Right? Because it’s all done correctly.

I doubt there is anything wrong with your Roblox Studio check the client script is where it is placed in the image, client code will not run outside of StarterPlayerScripts if there is no character appended to the player