Hey, i’m making a game and i need help with a script.
The script is a broadcast system, where you put a message in a textbox and the message is shown for the entire server, kinda how it is in admin commands.
Can anyone help me please?
This is not for spoon feeding scripts to people, you must have a script that we can help you with that you made, and then we will make it for you.
In order for one to succeed you must try first.
As @lootwise said, in the Dev Forum you are not allowed to ask for whole scripts.
If you need a place of reference, Use a for loop, Insert the GUI into each player, and delete it after a certain amount of time.
Example:
for index, player in pairs (game.Players:GetPlayers()) do
local cloneGUI = game.ServerStorage:WaitForChild("MyGuiName"):Clone()
cloneGUI.Parent = player:WaitForChild("PlayerGui")
end
wait(10) -- Time to wait until it is deleted.
for index, player in pairs (game.Players:GetPlayers()) do
local GUI_TO_DELETE = player.PlayerGui:FindFirstChild("MyGuiName") -- GUI to delete
if GUI_TO_DELETE == nil then return end -- Just in case a player joins in between this process.
GUI_TO_DELETE:Destroy()
end
I already made one and i am asking for help in the forums because i coudn’t do it myself, in the script i made i made a gui, inside it a text box and a button, when you press the button i used a remove event to create a new Message class in the workspace with the text being the text in the texbox, but that didn’t work.
I tried using the Message class instead
Can you please tell us the script so we can fix it for you or tell you the errors?
If you’re looking to make a message in the entire server, you could make a RemoteEvent and use FireAllClients with the message.
Sure thing!
Script used inside the textbox:
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")
script.Parent.MouseButton1Click:Connect(function()
message = script.Parent.Parent.TextBox.Text
remoteEvent:FireServer()
end)
Script in serverscriptservice:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Broadcast")
local function Broadcast()
local message = Instance.new("Message",workspace)
message.Text = message
wait(10)
message:Destroy()
end
remoteEvent.OnServerEvent:Connect(Broadcast())
Im not a professional in scripting by the way
May I have a hierarchy of your StarterGui and the location of the RemoteEvents and Scripts? Preferably screenshotted.
Ok, where do you want it? Discord?
I have updated the second post. Use that as a place of reference
EDIT: Type larger messages. It clutters the topic with a lot of small ones.
EDIT #2: You can also change the text of the messages there as well.
Here is fine. But discord works jaden#0438
A lot of holes in this script, for example:
The localscript is not telling the server any message.
On the server script, you did not define any function called Broadcast().
The serverscript did not receive anything called a ‘message’.
It’s setting a text to an instance?
On the first localscript, make sure you fire the message to the server.
remoteEvent:FireServer(message) -- This way the server will receive the message string.
Then have the server process the newly given information from the client.
remoteEvent.OnServerEvent:Connect(function(firer, message) -- The fire is the player that fired the event, the message is the message string you passed earlier
local newMessage = Instance.new("Message")
newMessage.Text = message -- The information passed on earlier
newMessage.Parent = workspace
end)
Not familiar with the Message instance and its uses, so this is what I can help with for now. Hope you can understand it a little better
Message class works the same as the Hint but thank you for your help
That helps a lot too, thank you