Issue with having a fired GUI be visible to new players who join

I know the title is long, sorry.

Hi devs,
So I am making a message command and once someone uses the command, a RemoteEvent is fired so everyone in the server can see the GUI. The command is: “:tm [message]” and the GUI shows the message of the person who used the command.

My issue is that, when the command is used, new players who join the server cannot see the GUI. I want the GUI to be visible to everyone in the server, as well as those who join.

I haven’t tried anything yet because I don’t know where to start. But if you know what I should do, please let me know! I’ll be providing my local and server scripts and if you see anything that I could add to help me achieve my goal, please don’t hesitate to contact me.

Server script:

local Settings = {
	["GroupId"] = "4789069";
	["AllowedRank"] = 13

local replicatedStorage = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")
local event = replicatedStorage.FilterText

		local messageArgs = msg:split(" ")					
		if messageArgs[1]:lower() == ":tm" and plr:GetRankInGroup(Settings.GroupId) >= Settings.AllowedRank then
			local commandReason = msg:sub(messageArgs[1]:len() + 2,-1)
			local player = plr.Name
			game.ReplicatedStorage.FilterText.OnServerInvoke = (function(player, commandReason)
				 local filteredTextResult = TextService:FilterStringAsync(commandReason, player.UserId)
				 return filteredTextResult:GetNonChatStringForBroadcastAsync()
			game.ReplicatedStorage.SendTopMessage:FireAllClients(commandReason, player)
			print(plr.Name .. " has shouted: " .. commandReason) -- Debug
		elseif msg == ":clrtop" and plr:GetRankInGroup(Settings.GroupId) >= Settings.AllowedRank then
			local player = plr.Name

Local script:

	local filteredText = game.ReplicatedStorage.FilterText:InvokeServer(commandReason)
	script.Parent.Message.Text.Text = filteredText
	script.Parent.Message.TitleBar.Title.Text = "Pinned Message from "..player
	local frame = script.Parent.Message
	frame:TweenPosition(, 0,0, 0))

	print(player.." has cleared the shout")
	local frame = script.Parent.Message
	frame:TweenPosition(, 0,-0.4, 0))

Thank you once again!

1 Like

The way I would go about doing this is by adding a BoolValue that toggles to true once the command is called. Then, I would make a new function -that triggers when a player is added- that checks if the BoolValue is set to true, and repeats the command if it is true.

In order to include the parameters, I would simply create a variable and then define them while the command is called, so I can use them in the new function.

Sorry if my idea doesn’t work. I don’t really work with strings and TextService, and have never heard of InvokeServer, so that got me a bit confused.

Do you know how I would repeat the command once the function checks that the BoolValue is true?

Can’t you just fire the RemoteEvent to the player instead of just everyone? I’m not understanding the problem here.

U could have a String value and change the String value, on the LocalScript use StringValue.Changed to listen if the value changes. Since Values use a modified .Changed event it will give the the new value is the first parameter.

I just want to say, thank you @Galaxy_Guest and @LukaDev_0 for your guys’ wonderful and helpful replies. I was able to figure it out.

Basically, I added a BoolValue that becomes true when the RemoteEvent is fired. Then, once the command is cleared, the Value becomes false.

What I added is for the GUI position to move when a new player is added:

	if visible.Value == true then
		game.StarterGui.SetMessage.TitleBar.Position =,0,0,0)
		game.StarterGui.SetMessage.TitleBar.Visible = true
		game.StarterGui.SetMessage.TitleBar.Title.Text = "Pinned Message from "..user.Value
		game.StarterGui.SetMessage.TitleBar.Message.Text.Text = text.Value
		game.StarterGui.SetMessage.TitleBar.Position =,0,-0.08,0)
		game.StarterGui.SetMessage.TitleBar.Visible = false

visible is the name of the BoolValue. The position is changed everytime a new player joins, for as long as the visible value is true. Once the visible value turns off, the script makes sure the GUI remains hidden.

The position (0,0,0,0) is when the GUI is shown, while (0,0,-0.08,0) is when the GUI is hidden. So while visible.Value == true, the position will move so that the GUI is visible to the new player.

user.Value and text.Value are both StringValues that change when the text is changed. text is the actual message and user is the player who used the command.

Also, InvokeServer is used to filter the command, in order to prevent inappropriate words from being shown to everyone.

What I am saying may be a bit confusing. If you have any questions, feel free to reply back. Once again, thank you both.

1 Like