ServerScriptService.Cmds.Info:11: attempt to index nil with 'FindFirstChild'

Please help me with this!

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		local args = string.split(msg, " ")
		local plruser = args[2]
		local user = game.Players:FindFirstChild(plruser)
		
		if user then
			if plr.PlayerGui.Info then
				plr.PlayerGui.Info.Frame.Age.Text = "Roblox account age: ".. game.Players:WaitForChild(plruser).AccountAge
				plr.PlayerGui.Info.Frame.Rank.Text = "Rank: ".. game.Players:WaitForChild(plruser):GetRoleInGroup(33075577)
				plr.PlayerGui.Info.Frame.Exp.Text = "Exp: ".. game.Players:WaitForChild(plruser).leaderstats:FindFirstChild("Exp"):FindFirstChild("Value")
				plr.PlayerGui.Info.Frame.Warns.Text = "Warns: ".. game.Players:WaitForChild(plruser).Warns.Value
				plr.PlayerGui.Info.Frame.Character.Image = game.Players:WaitForChild(plruser):GetUserThumbnailAsync(plruser.Userib, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
				plr.PlayerGui.Info.Frame.Visible = true
			end
		end
	end)
end)
1 Like
  1. Value isn’t a child of a Number/IntValue, it’s a property and is accessed normally (.Value)
  2. Any of these objects may not be loaded yet when the script runs, try using WaitForChild on all of them
    It would be something like this:
plr.PlayerGui.Info.Frame.Exp.Text = "Exp: ".. game.Players:WaitForChild(plruser):WaitForChild("leaderstats"):WaitForChild("Exp").Value
1 Like

It shows me this error now.
Infinite yield possible on 'Players.RobloxSupp515.leaderstats:WaitForChild("Exp")

1 Like

That means there isn’t an object called “Exp” in the leaderstats of the player, check if there is

I do have it, is just getting it somehow.

Sorry I don’t get what you mean, does it work with just the error or no?
If it does then you don’t need to worry much about that
If it doesn’t then it may be created on the client which doesn’t replicate to the server

1 Like

Not sure what you mean, But i’m doing this on the script, not a localscript or a modulescript

Does it work though? That’s all I want to know
If it doesn’t then I have no idea

1 Like

It works for other scripts., but it doesn’t work on this.