I mean.
local players = game:GetService("Players")
local nameplayer = players:GetPlayerFromCharacter(character)
local player = game:GetService("Players").nameplayer
Would this work?
I mean.
local players = game:GetService("Players")
local nameplayer = players:GetPlayerFromCharacter(character)
local player = game:GetService("Players").nameplayer
Would this work?
Here's your answer
local players = game:GetService("Players")
local player = players:GetPlayerFromCharacter(character)
But I should say, third line of yours is so wrong. You can't use content of variable like .nameplayer, that would check for a player named "nameplayer". You should use :FindFirstChild(nameplayer) or [nameplayer]. Also, nameplayer in your second line is player, not name of player. For name of player you would need players:GetPlayerFromCharacter(character).Name
Often, character has same name with player but still, GetPlayerFromCharacter is a good practice.
Yes it would but you would not need the third variable. The second variable would suffice for the player.
This discussion is preserved as it was. New answers, comments, and votes are closed.