Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to a get player instance without :GetPlayerFromCharacter?

Asked by 3 years ago

To get a player instance it's common to use :GetPlayerFromCharacter(character) but is there another way of getting it without the player touching an object?

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Yes. It is possible. For the GUI, the GUI's parent is the player's PlayerGui and you can use this for example. However, there's much more way to do this and not only for GUI. Hope this helped!

local player = script.Parent.Parent -- This will get a player.

-- The code
0
uh no? you can just use game.Players.LocalPlayer VikkiVuk 74 — 3y
0
maybe its a server sided script FalexForojanJunior 2 — 3y
0
Yes, it is a server sided script. FordJungZaza 15 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

You can just do like:

local PlayerName = "_____" --Name of the player you want to get

game.Players:FindFirstChild(PlayerName)
--It really works this way, trust me
0
This also works, but it is specific. FordJungZaza 15 — 3y

Answer this question