The link I provided shows you exactly how to get the player when they join?..
Are you trying to create a function in a module that handles a specific target player?
If you want to get a player’s character from a server script, you’ll have to find the player’s instance in game.Players instead of using Players.LocalPlayer, as the server holds all the players at once and doesn’t have one specific player it controls.
Something like this should function:
local Players = game:GetService("Players")
function GetPlayersCharacter(playername)
local TargetCharacter
local TargetPlayer = Players:FindFirstChild(playername)
if TargetPlayer ~= nil then
TargetCharacter = TargetPlayer.Character
end
return TargetCharacter
end
You’ll have to set up a function like this in your modulescript though, and check to make sure a player’s character model exists before proceeding to carry out any further execution in any other script you call this function from.
Sorry If I Was Late But As @GetGlobals said, You Can Use PlayerAdded
example
local Module = {}
Module.StartUp = function()
local Player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() -- waits for player
--add your code
end