So basically what I want to do is make a radio system where if a player enters a word into a text box it’d clone a frame with the text and be visible to the server.
How would I do that by using remote events?
This is my client script
local Replicated = game:GetService("ReplicatedStorage")
local remote = Replicated:WaitForChild("radioclientremote")
local textbox = script.Parent.Parent.textboxenter.TextBox
local textboxc = script.Parent.Parent.textboxenter.done
local callsignframe = script.Parent.Parent.Callsign.TextBox
textboxc.MouseButton1Click:Connect(function()
remote:FireServer(textbox.Text,callsignframe.Text)
local frame = game:GetService("ReplicatedStorage").REPLICATION:clone()
frame.Parent = script.Parent.Parent.ScrollingFrame
frame.MESSAGE.Text = textbox.Text
frame.CALLSIGN.Text = callsignframe.Text
end)
Then on the Server you need to distribute the signal to other so it updates for them.
You’ll likely run into a problem though : New players joining the game won’t see previous changes, so you’ll need to save the latest state, and update newly joining players of the latest state of the GUI
local message1 = ""
local message2 = ""
-- text1 and text2 is the textbox.Text and callsignframe.Text you passed from the client
remoteEvent.OnServerEvent:Connect(function(text1, text2)
remoteEvent:FireAllClients(text1, text2)
message1 = text1
message2 = text2
end)
game.Players.PlayerAdded:Connect(function(player)
remoteEvent:FireClient(player, message1, message2)
end)
Client: (you can do this in the same localscript where you fired the remove from first)
remoteEvent.OnClientEvent:Connect(function(text1, text2)
-- make gui visible and change the text
end)
game.ReplicatedStorage.radioclientremote.OnServerEvent:Connect(function(player, text1, text2)
local plrGui = player.PlayerGui
end)
Local Script
local Replicated = game:GetService("ReplicatedStorage")
local remote = Replicated:WaitForChild("radioclientremote")
local textbox = script.Parent.Parent.textboxenter.TextBox
local textboxc = script.Parent.Parent.textboxenter.done
local callsignframe = script.Parent.Parent.Callsign.TextBox
script.Parent.MouseButton1Click:Connect(function()
remote:FireServer(textbox.Text,callsignframe.Text)
end)