I have a system where the player inputs text, sends it to the remote event, server script handles it and prints it in a text label. But for some reason, it only prints on the client’s text label that inputs the original text and does not show for the other players in the game and is supposed to print on every client’s text label Any help appreciated on why this is not working. Thanks in advance
Local Script
local Label = script.Parent.Parent.TextLabel
local Textbox = script.Parent.Parent.TextBox
local Remote = game.ReplicatedStorage.SendMsg
script.Parent.MouseButton1Click:Connect(function()
local Textboxtext = Textbox.Text
game.ReplicatedStorage.SendMsg:FireServer(Label, Textboxtext)
print("Sent")
end)
Server Script
local Remote = game:GetService('ReplicatedStorage').SendMsg
local TypeSound = game.Workspace.dialogueblip
local TextLabel = game.StarterGui.ScreenGui.Frame5.TextLabel
local TexBox = game.StarterGui.ScreenGui.Frame5.TextBox
local function sendmsg(object,text,length)
print("Check 1")
for i = 1,#text,1 do
object.Text = string.sub(text,1,i)
wait(0.05)
TypeSound:Play()
end
end
game.ReplicatedStorage.SendMsg.OnServerEvent:Connect(function(player, Label, Textboxtext)
sendmsg(Label, Textboxtext)
print("Received")
print(Textboxtext)
end)
Essentially does nothing. Even if you do pass the player it would only go into effect for that player. I would recommend having another remote event that passes the text that fires to all clients.
local Remote = game:GetService('ReplicatedStorage').SendMsg
local TypeSound = game.Workspace.dialogueblip
local TextLabel = game.StarterGui.ScreenGui.Frame5.TextLabel
local TexBox = game.StarterGui.ScreenGui.Frame5.TextBox
local sendTextEvent = game.ReplicatedStorage.YOUREVENTHERE
game.ReplicatedStorage.SendMsg.OnServerEvent:Connect(function(player, Label, Textboxtext)
sendTextEvent:FireAllClients(Textboxtext)
end)
And then have another script on client that handles this event. Let me know if this works!
You would make a second remote event and another local script to handle that remote event, or you could add to the original local script if you want. The second script in my post is a replacement for your current server script
So the replacement server script you said is just a replacement for the server script and I would make another local script to connect to the server script to do the actual function?
Replace your original server script with the one I made. Make another remote event in replicated storage. Add some code either in the original local script you made or another one the changes the text when it receives the event.