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)
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
You can see in that picture