How to disable AutoLoadCharacter for specific player

I want someone to disable AutoLoadCharacter for certain players (disable CharacterAutoLoads locally)

Currently I have no idea how to do that

Disable AutoLoadCharacter globally. Then create your own autoload system that has the ability to disable autoloading for particular players.

1 Like

I… have tried doing that but I made things worse
image
The studio froze afterwards

There’s a function called Player:LoadCharacter(). You’ll need to use this when you’d like to load a player manually instead. To create your own autoloader, you’ll want to load the character when the player is added.




Well I can show you my scripts! (man, my scripting skills is just like yandere dev and it sucks)

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player) 
  player:LoadCharacter()
end)


it is that and the script you showed just loads the character when the player joins, I want to do it after a delay (game.Players.RespawnTime) imagewhen they dies.

Then why not just do

task.delay(player.RespawnTime, function() 
  player:LoadCharacter()
end)

Either way, a loop is unneccessary.

please read my codes, it will show you more detail of what I am trying to do, this is quite an error man.

oh wait no I think I figured it out randomly, you’re maybe right I dont need a loop!
I will try to remove the loop and fix it, if it work ima close this case!

@T0ny ok, first the code does need a loop but I did needed to change the function a bit

not it works almost fine but my game have things like death screen guis and they didn’t showed up when I tested the new changed scripts

Death screen script:

local Player = game.Players.LocalPlayer

local Animating = false

repeat
	game.StarterGui:SetCoreGuiEnabled("Health", false)
	wait()
until game.Players.LocalPlayer:FindFirstChild("StartVal")

while wait(0.06) do
	if game.Workspace:FindFirstChild(Player.Name) then
		local Character = game.Workspace:FindFirstChild(Player.Name)
		local Humanoid = Character:FindFirstChild("Humanoid")
		
		if Humanoid.Health <= 0 then
			if Animating == false then
				Animating = true
				local IsRepsawned = false
				script.Parent.Enabled = true
				
				local PersAge = math.random(56, 643)
				local Count = 0
				local Increasement = (math.floor(PersAge * 0.02 + 0.5))
				
				for i = 1, 4 do
					script.Parent.Flash.BackgroundTransparency -= 0.25

					Player.CharacterAdded:Connect(function()
						if Animating == true then
							IsRepsawned = true
						end
					end)
					
					game:GetService("RunService").RenderStepped:Wait()
				end
				
				script.Parent.Flash.BackgroundTransparency = 0
				script.Parent.Background.BackgroundTransparency = 0
				script.Parent.Background.Title.TextTransparency = 0
				
				for i = 1, 10 do
					script.Parent.Flash.BackgroundTransparency += 0.1

					Player.CharacterAdded:Connect(function()
						if Animating == true then
							IsRepsawned = true
						end
					end)
					
					game:GetService("RunService").RenderStepped:Wait()
				end
				script.Parent.Flash.BackgroundTransparency = 1
				wait(1)
				for i = 1, PersAge do
					Count = math.clamp(Count + Increasement, 0, PersAge)
					script.Parent.Background.Desciption.Text = Count.. " years after your incident..."
					script.Parent.Background.Desciption.TextTransparency = math.clamp((script.Parent.Background.Desciption.TextTransparency - 0.02), 0, 1)

					Player.CharacterAdded:Connect(function()
						if Animating == true then
							IsRepsawned = true
						end
					end)
					
					game:GetService("RunService").RenderStepped:Wait()
				end
				
				repeat
					Player.CharacterAdded:Connect(function()
						if Animating == true then
							IsRepsawned = true
						end
					end)
					game:GetService("RunService").RenderStepped:Wait()
				until IsRepsawned == true
				
				for i = 1, 10 do
					script.Parent.Background.BackgroundTransparency += 0.1
					script.Parent.Background.Title.TextTransparency += 0.1
					script.Parent.Background.Desciption.TextTransparency += 0.1
					game:GetService("RunService").RenderStepped:Wait()
				end
				script.Parent.Flash.BackgroundTransparency = 1
				script.Parent.Background.BackgroundTransparency = 1
				script.Parent.Background.Title.TextTransparency = 1
				script.Parent.Background.Desciption.TextTransparency = 1
				
				script.Parent.Enabled = false
				IsRepsawned = false
				Animating = false
			end
		else
			script.Parent.Enabled = false
			script.Parent.Background.BackgroundTransparency = 1
			script.Parent.Flash.BackgroundTransparency = 1
			script.Parent.Background.Title.TextTransparency = 1
			script.Parent.Background.Desciption.TextTransparency = 1
		end
		
	end
end

Your first code loops to find the local player, which it already has. Then check to see if the player’s character is in the workspace. Though it’s not even checking for the character in an efficient manner.

To then connect a Humanoid.Died event that removes the character using a remote event… which is not required. To then fire another remote event to then respawn the character after waiting for respawn time. All inefficiently.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player) 
 player.CharacterAdded:Connect(function(character) 
    local humanoid = character:FindFirstChild("Humanoid")
    humanoid.Died:Connect(function() 
        task.delay(player.RespawnTime, function() 
            player:LoadCharacter()
        end)
    end)
  end)
end)

You need neither a loop, nor remote events for any of this behavior. Also if you wanted to know if a player had a character you could check player.Character. I’d really recommend taking a look at the developer hub for documentation.

As far as the death screen goes, it’s a separate implementation, and the code would need to be adjusted for that.

1 Like

Wow! You are right! I have just twerked the death screen script abit and everything works now! wow, it was amazing! :grinning_face_with_smiling_eyes: thanks!

1 Like