I am new to scripting, But basically I am making a Lanyard which is a Touch to Equip Item, and it’s supposed to have the players username, group rank and profile picture visible on a Surface GUI. I managed to successfully do that with a local script but I need help converting it into a Server Script as I am not able to define the term “Player”.
The script used is given below:
Getting the players profile picture: –Local Script
local player = game.Players.LocalPlayer
local Image = script.Parent
local userId = player.UserId
local thumbType = Enum.ThumbnailType.AvatarBust
local thumbSize = Enum.ThumbnailSize.Size420x420
local content = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
Image.Image = content
And the script used to get players group rank: –Local Script
local player = game.Players.LocalPlayer
local Text = script.Parent.Text
Text = tostring(player:GetRoleInGroup(7906994))
You could have this localscript send a remote event to the server with the Instance the text and image are in. Remote events pass the sending player as a parameter so you would be able to reference their .UserId the same on the server.
Highly suggest referring to this persons reply. If you are confused on what server events are, here’s a Article from The Roblox Developer Hub that explains all about it.
As in it’s a distributed freemodel? You would have to put the server script inside the model and have some text-only script file called README!!! or something to tell the end user to place the event handling script inside ServerScriptService