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

Character cannot be found even with great amounts of time?

So I have this code below, and nothing is wrong with it as it warns me that there is no character and there is no errors, but since it never finds the character, I'm wondering why it doesn't find it as when I looked at myself in the player list, my Character was listed as a property.

local Players = game:GetService("Players")
local replstor = game:GetService("ReplicatedStorage")
local marble = replstor.Marble

Players.PlayerAdded:Connect(function(plr)
	local plrmarble = marble:Clone()
	local Character = plr:WaitForChild("Character", 10)
	if Character then
		plrmarble.Position = Character.Torso.Position
	else
		warn("Character not found")
	end
	plrmarble.Name = plr.Name .. "'s " .. "Marble"
	plrmarble.Player.Value = plr
	plrmarble.Parent = workspace
end)

1 answer

✓ Accepted answer

The “character” is not a child of player instead it’s a property of player use CharacterAdded:Wait() this will ensure the script resumes after the character is added

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