Help with accessing a value within the players client when clicking a textbutton which has the players name then returning the value to a text label

“Server Script” goes under ServerScriptService
“Client Script” goes in your GUI or in your Callsign TextBox
and to get a persons Callsign when you click on a name in the list, just add this to your TextButton’s clicked event: (This assumes that “Player” is the Player instance the TextButton represents)
(And that SignLabel is the TextLabel that displays the callsign)

SignLabel.Text = Player:GetAttribute("Callsign") or Player.DisplayName

How would I get the player from text

I’m gonna assume you had to get their Name for the TextButton from somewhere.

What I’m saying is, how would i get the player from the textbuttons text

as i can’t access the player instance without referencing player properly

Assuming that TextButton.Text is set to Player.Name,
you just do:

local Player = game:GetService("Players"):FindFirstChild(TextButton.Text)

Basically for every player found it clones a gui and the gui text becomes the player name

And your client script errors eitherway with attempt to index nil with connect

this is the line CallsignTextbox.FocusLost:Connect(function(ClientPressedEnter)

It’s not plug and play, you need to change this line to the path of your TextBox, otherwise it won’t work.

ok i noticed i needed to remove .text

Show me your explorer window (where you see the instance tree) So I can see where the script is located and where your textbox is

edit: k

however it now errors with onserverevent is not a valid member of remotefunction

You didn’t need to change this. The Server script makes its own Remote.

I didn’t heres my server script

local Remote = Instance.new("RemoteFunction")
Remote.Name = "CallsignEvent"
Remote.Parent = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")

local Players = game:GetService("Players")

local function FilterText(Text, UserId)
	local FilterResult
	local Success, Failure = pcall(function()
		FilterResult = TextService:FilterStringAsync(Text, UserId)
	end)
	if Success then
		return FilterResult
	elseif Failure then
		print("TextService:FilterStringAsync() failed:", Failure)
	end
	return nil
end

Remote.OnServerEvent:Connect(function(Player, Callsign)
	if type(Callsign) ~= "string" then return end
	if string.len(Callsign) == 0 then return end
	local FilterObject = FilterText(Player.UserId)
	if FilterObject then
		local FilteredString
		local Success,Failure = pcall(function()
			FilteredString = FilterObject:GetNonChatStringForBroadcastAsync()
		end)
		if Success then
			Player:SetAttribute("Callsign", FilteredString)
		end
	end
end)

and i’ve checked remotes only valid member is invokeserver as you’ve instanced a remote function

Ah, that’s my fault. Change Line 1 “RemoteFunction” to “RemoteEvent”

Probably got them mixed up writing it just after ranting about RemoteFunctions originally.

Now the text label is returning the players name and not the players callsign

heres the script

		currentofficersreplication.Button.MouseButton1Click:Connect(function()
					local Player = game:GetService("Players"):FindFirstChild(currentofficersreplication.Callsign.Text)
					officercallsign.Text = Player:GetAttribute("Callsign") or Player.DisplayName
				end)

They haven’t put a Callsign in yet then.
And also, use this code.

		currentofficersreplication.Button.MouseButton1Click:Connect(function()
					local Player = game:GetService("Players"):FindFirstChild(currentofficersreplication.Button.Text)
					officercallsign.Text = Player:GetAttribute("Callsign") or Player.DisplayName
				end)

The only change I made was to which Text you were using to get the Player. You were using Callsign.Text but you were clicking a button that you’ve previously said has its .Text set as their Name.

that won’t work as the callsign variable is where the players name is and getattribute isnt a valid member of player

edit: nvm it is a valid member

edit: however “Callsign” isnt and i’m unsure what callsign is

You really need to show us the Explorer window of this GUI. It’s so hard to help you just hoping you get everything right and I have no idea how it should work.