script.Parent.MouseButton1Click:Connect(function()
local ingameannouncement = script.Parent.Parent.IngameReason
if ingameannouncement.Text ~= "" then
if game.ReplicatedStorage.ifSend.Value == false then
script.Parent.Parent.IngameReason.Text = ""
game.ReplicatedStorage.sendAnnouncement:FireServer(ingameannouncement)
else
script.Parent.Text = "Hold your horses, cannot send now"
wait(1)
end
else
script.Parent.Text = "Announce"
end
end)
Exactly, I’m so confused because sometimes it does work but it doesn’t write out the message that was provided. I’ll provide the server script below;
local messaging = game:GetService("MessagingService")
local plr = game.Players.LocalPlayer
local success, errormsg, connection = pcall (function()
messaging:SubscribeAsync("Announcements", function(msg)
print(msg.Data)
print(msg.Send)
game.ReplicatedStorage.ifSend.Value = true
game.ReplicatedStorage.Reci:FireAllClients(msg.Data)
wait(5)
game.ReplicatedStorage.ifSend.Value = false
end)
end)
local success, errormsg = pcall(function()
game.ReplicatedStorage.sendAnnouncement.OnServerEvent:Connect(function(player, msg)
local rank = player:GetRankInGroup(9178694)
if rank >= 11 then
messaging:PublishAsync("Announcements")
else
warn("Your rank is not high enough to publish announcements!")
end
end)
```