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
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
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()
end)
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
game.ReplicatedStorage.RemoveMessage:FireAllClients(player)
end
end)
end)
Local script:
game.ReplicatedStorage.SendTopMessage.OnClientEvent:Connect(function(commandReason,player)
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(UDim2.new(0, 0,0, 0))
end)
game.ReplicatedStorage.RemoveMessage.OnClientEvent:Connect(function(player)
print(player.." has cleared the shout")
local frame = script.Parent.Message
frame:TweenPosition(UDim2.new(0, 0,-0.4, 0))
end)
Thank you once again!