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

is there any good explanation of :GetPlayerFromCharacter() ?

i dont realy understand it

1 answer

✓ Accepted answer

The function :GetPlayerFromCharacter() will take the character model and give you the player corresponding to that. For example, let's say a player touched my part, and I want to display a message on their screen, I could use the function :GetPlayerFromCharacter() to get the player model, like so:

script.Parent.Touched:Connect(function(hit)
	local character = hit.Parent
	local player = workspace:GetPlayerFromCharacter(character)
	if player then
		--code
	end
end)

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