LoadCharacter isn't working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make my player:LoadCharacter() work.

  2. What is the issue? Include screenshots / videos if possible!

The issue is that, I included a player:LoadCharacter() and it’s not loading me after my function.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I couldn’t find any solutions, but my script isn’t working. It doesn’t load my character.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local groupid = 5
local player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if player:IsInGroup(groupid) then
		player.TeamColor = BrickColor.new("Crimson")
		player:LoadCharacter()
	end
end)

What is the issue?

1 Like

I don’t think LoadCharacter() can be called from a Local Script. You would need a server-side script (called “Script”) to run it.

Still not working, I don’t think that could function a gui either.

“Load character can only be called by the server backend”
That’s the error you should get when you run that on the client. You can just have a remote that fires to the server.

remote:FireServer()
remote.OnServerEvent:Connect(function(player) --fun fact: the player us always defined, even if you don't define it.
player:LoadCharacter()
end)

Thanks super much, this helps alot.

I changed the gui script to:

local groupid = 32938675
local player = game:GetService("Players").LocalPlayer
local remote = game.ReplicatedStorage.RemoteEvent

script.Parent.MouseButton1Click:Connect(function()
	if player:IsInGroup(groupid) then
		player.TeamColor = BrickColor.new("Crimson")
		remote:FireServer()
	end
end)

Made a server script that fires the event

local remote = game.ReplicatedStorage.RemoteEvent
remote.OnServerEvent:Connect(function(player) --fun fact: the player us always defined, even if you don't define it.
	player:LoadCharacter()
end)

Then lastly make a remote event.

Much appreciated!

1 Like

I also recommend you do

local chr = player.Character or player.CharacterAdded:Wait()
chr:Destroy()

before the LoadCharacter since I heard it could accidentally cause a memory leak.

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