Is it possible getting the character on the server side using the parameter in PlayerAdded?

I keep getting an error: attempt to index nil with 'WaitForChild'
this is my code, im trying to make a timer server sided:

game.Players.PlayerAdded:Connect(function(plr)
	local jkds = plr.Character:WaitForChild("jkds")--this is the line i'm getting the error on,
--[[
jkds is a folder is in the player's character that contains two number values, minutes and seconds.
--]]
	local minutesvalue = jkds:WaitForChild("Minutes")
	local secondsvalue = jkds:WaitForChild("Seconds")
	local minutes = 61 
	local seconds = 19

also it only errors on that line, but not in this line, which i have placed a couple of lines down from this block of code:

	local char = plr.Character
   				local TalibanQualify = char:WaitForChild("Team_InfoHolder").TalibanQualify
   				TalibanQualify.Value = true
game.Players.PlayerAdded:Connect(function(plr)
     plr.CharacterAdded:Connect(function(char)

Just because the player is loaded doesnt mean the character is.

1 Like

If you want to get the Player’s Character via only using the PlayerAdded event, implement another variable that’ll check for 2 things: The Player’s Character or it’ll yield until the Character is loaded

game.Players.PlayerAdded:Connect(function(Player)
    local Character = Player.Character or Player.CharacterAdded:Wait()

    local jkds = Character:WaitForChild("jkds")
end)

Not sure why you’d wanna do this though

1 Like