I'm making some game, and when someone clicks a GUI, I don't want them to die, so I want to load their character, but I only know how to get to them in Workspace.
COMMUNITY QUESTION
How can I get to someone in Player through a GUI?
3 answers
From the gui you can use a localscript with the following line to get the player
local player = game.Players.LocalPlayer
You can also just use
local player = game.Players:FindFirstChild('Name of Player') if you want to get someone whose name you have.
If you're using a LocalScript, then game.Players.LocalPlayer will reference the player.
However, if you aren't, there's a simple solution.
m = game.Workspace.Player:GetPlayerFromCharacter() -- change "game.Workspace.Player" to variable for the actual player
m:LoadCharacter()
Hope I could be of help; good luck!
If you are using a LocalScript, you will be able to access the current player by the LocalPlayer property of the Players service.
local plr = game.Players.LocalPlayer
plr.Character:BreakJoints() -- kill character
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Are you referring to the :LoadPlayer() method?