Can someone help me fix my script

Hi, I’ve been working on this script for a while, several hours on it, but I don’t know how to load the players character after they click play, I tried lots of ways I thought I knew, but it just does not work.

He What I Tired.

local function Regbutton(Button: TextButton)
	Button.MouseButton1Click:Connect(function()
	LocalPlayer:LoadCharacter()
	end)
end

and

local function Regbutton(Button: TextButton)
	Button.MouseButton1Click:Connect(function()
		player.CharacterAdded:Connect(onCharacterAdded)

		player:LoadCharacter()
	end)
end

Please Help me, I really need help.

1 Like

You can’t load character in a local script. Use a remote event to contact the server when you press the button and then load the character.
Local script:

local event = game.ReplicatedStorage.RemoteEvent
Button.MouseButton1Click:Connect(function()
   event:FireServer()
end)

Code below in a server script

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
   plr:LoadCharacter()
end)
1 Like

Ok @MysteryX2076, I’ll try that, Thank you for the help, I really apparated it.

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