Hello there, for the last week i’ve been trying to make an announcements billboard but i couldnt manage to script the part where you submit and text appears on the billboard
I tried using ContentText propertie of the TextBox but it failed.
If you know a little can you comment to make a disscussion here about the ways we can fix this problem?
I don’t think it was bad. It’s not my first language, so I don’t read it well sometimes
Using a remote event to fire the server with the information in the text box should work just fine. I would clone a template of a frame on the server side of things.
Server Code (ServerScript in ServerScriptService)
local replicatedStorage = game:GetService("ReplicatedStorage")
replicatedStorage:WaitForChild("ServerMessage").OnServerEvent:Connect(function(player, text)
local clone = script:WaitForChild("Template"):Clone()
clone.Name = player.Name
clone.TextLabel.Text = text
clone.Parent = workspace.Part.BillboardGui
end)
Client Code (LocalScript in GUI)
local replicatedStorage = game:GetService("ReplicatedStorage")
local serverMessage = replicatedStorage:WaitForChild("ServerMessage")
local gui = script.Parent
local frame = gui:WaitForChild("Frame")
local submit = frame:WaitForChild("Submit")
local input = frame:WaitForChild("Input")
submit.Activated:Connect(function()
serverMessage:FireServer(input.Text)
end)
input.FocusLost:Connect(function(enterPressed) --// Optional
if enterPressed == true then
serverMessage:FireServer(serverMessage.Text)
end
end)
You’ll need to add a remote event into ReplicatedStorage named “ServerMessage”
You’ll also need to change the code accordingly to how your game is setup of course
I would also highly recommend using TextService to filter the text on the server. Without it, anyone who uses it can send things not allowed by the chat filter normally, which could result in your game being taken down and possibly getting you banned or terminated