local player = hit.Parent:GetPlayerFromCharacter()
I've made a teleport script that teleports players into the fighting arena for my game. Just recently I decided to look back into the script to add in the "inCombat" mode once they've used the teleporter, but in order to turn on the value that's in the player's stats folder I have to get to the player.
The teleporter is a simple touch event. I thought if I were to get the player who is touching the part, and reference their character by doing hit.Parent then adding :GetPlayerFromCharacter() it would lead me to be able to enter the stats folder in the player.
I'm assuming I'm using :GetPlayerFromCharacter() wrong, so is there a way I can access the player through a .touched event at all?
16:11:08.543 - GetPlayerFromCharacter is not a valid member of Model 16:11:08.544 - Stack Begin 16:11:08.544 - Script 'Workspace.DoorTeleporter.Teleport', Line 20 16:11:08.544 - Stack End
is the error that I'm receiving.
I tried checking if maybe I'm not getting the actual character model in the workspace by using print(). I put in print(hit.Parent) and it gave me the character name, so I'm completely lost on why it's not working.
Does :GetPlayerFromCharacter() have a different function that I'm not understanding? And if it does, what's the proper way to access the player through a .touched event? Is that possible?

1 comment
I literally just solved this issue by checking in the ROBLOX Developer page and looking into :GetPlayerFromCharacter() and it told me the same thing. But thank you so much for the help; always appreciate the answers. Next time I'll definitely also look at the ROBLOX Developer page before asking questions. Would've saved lots of time.