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

What am I doing wrong Im trying to define a humanoid and its not working?

Okay so this Server Script is inside ServerScriptService and im trying to define a Humanoid by using the parent method but it keeps giving me a error that its not a valid member of data model

heres the script

hum = script.Parent.Parent.Humanoid
print(hum)

1 answer

✓ Accepted answer

You want to let it print the Name of the humanoid if you want to use print()

hum = script.Parent.Parent.Humanoid
print(hum.Name)

But, a Humanoid inside of a players character would not be any parent of ServerScriptService. The serverscriptservice is only parented by "game".

If you want the player's humanoid, do this:

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function()
		local hum = player.Character:WaitForChild("Humanoid")
		print(hum.Name)
	end)
end)

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