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.
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