Everytime I join my game in normal roblox player client, it disconnects, unless if it's in studio. Does it happen when I set characterautoloads to false? I want to keep it false to prevent auto-spawning. Is there a certain trick/method to it?

A chunk of the code:

-- there is more to the code, I may give more if needed.
--I prefer 'STRING' over "STRING"
player.CharacterAdded:connect(function(character)
	repeat wait() until player.Character:FindFirstChild('Humanoid') ~= nil
	if not oncespawned then oncespawned = true player:LoadCharacter(false)
 	player.CharacterAppearance = '' end
	changeappear(player.Character)--I give the player a randomized look.
	player.CharacterAppearance = ''
	repeat wait() until player.Character:FindFirstChild('Humanoid') ~= nil
	character.Humanoid.Died:connect(function()
		wait(10)
		player:LoadCharacter(false)
	end)
	character.Humanoid.Changed:connect(function()
		if character.Humanoid.PlatformStand == true then
			player.CharacterAppearance = ''
			wait(5)
			player:LoadCharacter(false)
		end
	end)
end)