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

you can use remote events. When the player enters text into the textbox you FireServer and send the text value then store that value into a stringValue object however you want.

My idea is parenting the value to the player however, how would i do it with remote events?

Em i made it check it out haha it took 30 minutes to make it )
Classic Baseplate.rbxl (39.8 KB)
But change in this Server script to your name you need it for defense cuz hackers can call remotes events)

You will be able to get any player’s callsign that is playing in your server)


so you just press load button and click on player’s name and it will print player’s callsign

are you sure because it says if player.name = = “kercig”

Em yes change it to your name or delete this condition if you want every player be able to get player’s callsign

It’s very raw so you can copy something from there to your game.

it errors with attempt to index nil with onserver event here’s the script

local rs = game:GetService("ReplicatedStorage")
local callsignsend = rs:FindFirstChild("CallSignSend")


-- done :D

local callsignrecieve = rs:FindFirstChild("CallSignRecieve")

callsignrecieve.OnServerEvent:Connect(function(plr,plr2)
	if plr.Name == "Polyrabies" then
		print(callsignrecieve:InvokeClient(plr2))
	end
end)

That means that it can’t find callsignrecieve with name “CallSignSend” in replicated storage because
call signrecieve == nil.

What do you mean, it’s in replicated storage

I guess the name “CallSignSend" doesn’t equal to the name of your remote event in replicated storage.

No. No. Just NO.

Do NOT use a RemoteFunction, ESPECIALLY in this scenario.

The article you linked quite literally discourages using .OnClientInvoke with RemoteFunctions!

Not only did you ignore this, you didn’t add ANY filtering. You have to filter text that comes from another client, that’s the rules.

Here’s how you SHOULD do it.

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)

Client Script:

local Remote = game:GetService("ReplicatedStorage"):WaitForChild("CallsignEvent")
local Client = game:GetService("Players").LocalPlayer
local CallsignTextbox = Client.PlayerGui.YourPathHere -- Change this.

CallsignTextbox.FocusLost:Connect(function(ClientPressedEnter)
  if ClientPressedEnter then
    Remote:FireServer(CallsignTextbox.Text)
  end
end)

And, to get a players Callsign, anywhere you need to you just do this:

local Callsign = Player:GetAttribute("Callsign") or Player.DisplayName
-- "or DisplayName" is just to make sure that if they have yet to set a callsign,
-- it won't be just blank.

Edit: And, as a bonus, this also makes its own Remote on runtime.

That literally makes 0 sense, what I’m simply seeking is a way to access the text a player entered in a textbox,

and for the text they entered to display on a text label

Also i didn’t ignored that i have accepted the risk.
I have just made an easy prototype for him.
He can change it whatever he wants)
And i wanted to make it fast that’s why i made it through functions and invoke client.

Yes. That’s what it does.

This would change an attribute when a client changed their callsign, but if you’re showing it to other players, it has to be filtered. No exceptions.

This section here is how you would get that text to display on the textlabel.
TextLabel.Text = Callsign

The rest of the post is a server script that does the filtering and replication.

Edit: I take it you got the gist.

where would the attribute script go

As I still need to be able to click a textbutton which has the players name as the text then change a text label to the players callsign

image

You can see in that picture