Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you detect if a players character is fully loaded?

This is the LocalScript used:

local player = game.Players.LocalPlayer
local HumanoidRootPart = player:FindFirstChild("HumanoidRootPart")

game.Players.PlayerAdded:Connect(function()
	if HumanoidRootPart == true then
		print("HumanoidRootPart was detected!")
	else
		wait()
		if wait(20) then
			print("Your internet doge .-.")
	end
end)

Please forgive me if I have made a lot of errors, I started scripting last month.

5 comments

0

Can i ask u how u posted lua code like this?

0

you press the lua sybol then paste the code inside the area

0

They're talking about your indentation...

0

I press tab

0

dude.. seriously? PlayerAdded exists

4 answers

@everyone I have found an easier method like so:(This script was entirely made by myself)

--Start by defining variables
local ContentProvider = game:GetService("ContentProvider")
local WholeGame = game:GetChildren()
local MainFrame = script.Parent
local textLabel = MainFrame.TextLabel

ContentProvider:PreloadASync(WholeGame)-- When game gets all of its children


textLabel.Text = "Loaded!!"
wait(2)
MainFrame:TweenPosition(blah blah blah)

--Done

Maybe try to identify the spawn, and then find the position of the spawn location, ~~~~~~~~~~~~~~~~~ if HumanoidRootPart.Positon = YourSpawnPositonHere then print("HumanoidRootPart Detected") end

make sure the spawn is collision off, and try to find the position of the humanoid root part when it loads, maybe you don't have to use the spawn.

2 comments

0

But doesnt that mean that the spawn has to be the exact position and shape of the humanoid root part

0

Yeah, Try to test it, then go to the spectator mode (Servermode) and select the humanoid root part, find the position of it using its properties and you should be able to implement that in the script

Roblox has an in-house event for this. It is called CharacterAdded, and can be used on a player. Here is an example of how this would work:

randomPlayer.CharacterAdded:Connect(function()

end)

Now, if you wanted to use this event only once, you could do the following:

local character = player.Character or player.CharacterAdded

This would look for a character, and if there is none, the or keyword will tell it to wait until CharacterAdded is triggered.

-- Services

local Players = game:GetService('Players') -- Gains access to the Players Service

-- Functions

local function OnPlayerAdded(Client) -- Function that fires whenever a Player enters the Server
	Client.CharacterAppearanceLoaded:Connect(function() -- This is the function that detects when all the assets of a Player's Appearance is loaded into their Character
		print(Client.Name .. "'s Character has fully loaded.")
	end)
end

-- Misc

Players.PlayerAdded:Connect(OnPlayerAdded)

1 comment

0

hope this helps

This discussion is preserved as it was. New answers, comments, and votes are closed.