Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What other way could I connect to a Player?

I usually have used game.Players.LocalPlayer while I'm trying to connect to the player from workspace. While this for some reason only works in - studio. If you could I would really like some other way to connect to the player.

1 comment

0

The LocalPlayer is only accessible in LocalScripts. Are you trying to use it in a server script?

1 answer

✓ Accepted answer

game.Players.LocalPlayer only works in a local script. Anyway there is another way to get the player. You could use the function :GetPlayerFromCharacter() In the () you put the character of the player. For example :

local tool = script.Parent --tool
local char = tool.Parent --the player's character
local player = game.Players:GetPlayerFromCharacter(char) -- this get the player that has this tool

Remember you can use :GetPlayerFromCharacter() for anything, it doesn't have to be a tool.

This discussion is preserved as it was. New answers, comments, and votes are closed.