I am making a touched event on a door that makes a GUI appear. But I just realized I need to put it in the player, not the character, except that touched events give the character, not the player. Help?
✓ ANSWER ACCEPTED
How to get a player from a touched event, not a character?
1 answer
✓ Accepted answer
The GetPlayerFromCharacter method of game.Players is what you're looking for:
part.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
--code
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Thanks for the fast answers!
Please provide an explanation behind your answer so the User has a better understanding on how to use it properly. :)
There's really not much to explain, Alpha.
GetPlayerFromCharacteris not a cryptic function name, and groovy already knows how to get the Character from a Touched event, as evidenced by his original question.I'm pretty sure the Function Name is self-explanatory.