Okay, so. I've tried to create a radio that allows you to write on it only when you press a specific button, which is P. And it works! The only problem is that, when I go in the game and write in the radio, I can see my messages but I cannot see others' ones. This is how I wrote my scripts:
LOCAL SCRIPT IN SCREENGUI (with another localscript inside it.)
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() local bool = false mouse.KeyDown:connect(function(k) k = k:lower() if k == 'p' then print("Hi") if bool == false then bool = true script.LocalScript.Disabled = false plr.PlayerGui.Radio.Frame.TextLabel.TextBox.BackgroundColor3 = Color3.new(0, 1, 0) plr.PlayerGui.Radio.Frame.TextLabel.TextBox.BorderColor3 = Color3.new(0, 1, 0) else bool = false script.LocalScript.Disabled = true plr.PlayerGui.Radio.Frame.TextLabel.TextBox.BackgroundColor3 = Color3.new(1, 0, 0) plr.PlayerGui.Radio.Frame.TextLabel.TextBox.BorderColor3 = Color3.new(1, 0, 0) end wait(0.5) print(bool) end end) --Yes, I know keydown is deprecated.
I made this script to make writing in radio only when you press P possible. The localscript that writes messages in radio into the one above:
local plr = game.Players.LocalPlayer local ChatStorage = game.Workspace.RadioStorage plr.Chatted:Connect(function(message) local stringval = Instance.new("StringValue", ChatStorage) stringval.Name = "["..plr.Name.."] "..message end)
Then, adding onto that. I put a localscript into the Radio GUI to upload the messages.
local chatbox1 = script.Parent.CB1 local chatbox2 = script.Parent.CB2 local chatbox3 = script.Parent.CB3 local chatbox4 = script.Parent.CB4 local chatbox5 = script.Parent.CB5 local chatbox6 = script.Parent.CB6 local chatbox7 = script.Parent.CB7 local chatbox8 = script.Parent.CB8 local chatbox9 = script.Parent.CB9 local chatbox10 = script.Parent.CB10 local chatbox11 = script.Parent.CB11 game.Workspace.RadioStorage.ChildAdded:Connect(function(chatstuff) wait(1) script.Sound:Play() chatbox1.Text = chatbox2.Text chatbox2.Text = chatbox3.Text chatbox3.Text = chatbox4.Text chatbox4.Text = chatbox5.Text chatbox5.Text = chatbox6.Text chatbox6.Text = chatbox7.Text chatbox7.Text = chatbox8.Text chatbox8.Text = chatbox9.Text chatbox9.Text = chatbox10.Text chatbox10.Text = chatbox11.Text chatbox11.Text = chatstuff.Name print(chatstuff) wait(1) end)
Please help me I do not know what I am doing wrong!
Local scripts affect the client while regular scripts. The reason why only you can see thr message is because your localscript only excutes code on your client only and not others. Try using remotes to communicate between client to server.
Example:
Local script
local RE=game:GetService('ReplicatedStorage'):WaitForChild('RemoteEvent'); RE:FireServer('wow FE');
Server Script
local RE_1=Instance.new('RemoteEvent',game:GetService('ReplicatedStorage')); RE_1.OnServerEvent:Connect(function(pl,a) print(tostring(a));--> 'wow FE' end);