Purchase Announcement Help

Hey there,

So I’m looking to make a piece of code that announces when a player purchases a Developer Product;
For example +25 HP, I was given this code by a friend of mine that scripts however it doesn’t seem to work and he doesn’t know why. Could I get some support on this?

local Player = game.Players.LocalPlayer

local Replicated = game.Replicated.Storage
local SendAnnouncment = Replicated.SendAnnouncment ---- This is a or should be a Remote Function located in the replicated storage

local GUI = script.Parent
local Buy+25HealthButton = GUI.Buy+25HEalth

  local Message = Player.Name.." bought the +25 Item!"

**In the Script located inside Server Script Service**
local Replicated = game.ReplicatedStorage
local SendAnnouncement = Replicated.SendAnnouncemnet
local ReceiveAnnouncment = Replicated.ReceiveAnnouncement -- This is a or should be a Remote Event located in the replicated storage

SendAnnouncment.OnServerInvoke = function(player, Message)

**An announcment recieve Local Script inside another Gui**
local Replicated = game.ReplicatedStorage
local ReceiveAnnouncement = Replicated.ReceiveAnnounement

  -----Function to show the announcment-----

If I were to  make this so that the following were added how do I do this?
Increase of 25 HP
Get Back In
Instant Deathmatch

Thank you all for the support.

Well first off why are you getting replicatedstorage like that?

He had sent me the script like that, I had noticed it before I had put it in and changed it. It was edited to;

local Replicated = game.ReplicatedStorage.Remotes

(Remotes being a folder of other remotes with different names.)

Any errors in the output possibly?

I would be careful with allowing the local script to generate the messages since it provides a loophole for exploiters to send unfiltered messages to the server.


Thats the only errors, as I’m not a professional scripter I wouldn’t have the slightest in these

Very aware of that, we have a decent anti that is linked it with 90% of our scripts, any tampering has the ability to remove them from the server.
I understand not all anti exploits are reliable however we aim to keep a close eye on the servers with regular discord webhooks