So, im currently working on a game like pls donate modded if you haven’t played it, basically you use fake money instead but anyways how do I make Global Variables in Chat?
For Example:
“HexticDev Found A Secret Dino 0.4%” in chat
So, im currently working on a game like pls donate modded if you haven’t played it, basically you use fake money instead but anyways how do I make Global Variables in Chat?
For Example:
“HexticDev Found A Secret Dino 0.4%” in chat
I’m not really sure why you need a gobal variable, but here’s a topic that tells you how to use global variables:
If this isn’t what you’re looking for, you can do a chat message like this by first formatting a string.
local formatted = string.format("%s found %s %s", playerName, itemName, itemChance)
Then, you would use a RemoteEvent to make all clients run this code with the formatted string:
game.StarterGui:SetCore("ChatMakeSystemMessage", {Text = PUT_THE_RECIEVED_CONTENT_NAME_HERE; Font = Enum.Font.SourceSansBold; Color = Color3.new(1,1,1); FontSize = Enum.FontSize.Size9})
I gave you an example, for all players in all servers to see what a player was awarded.
Are RemoteEvents like the most secure as in anti-exploitation do you know?
The RemoteEvent would be fired from the server, using :FireAllClients(). The event is to be used soley for the server to communicate to the client and tell it to put the message in chat. RemoteEvent’s used in this fashion are 100% safe and secure.
You Should not be using _G
, you should be using ModuleScripts
.
They Aren’t, they never were, thats why you have to secure them with Sanity Checks.
You would be using MessagingService
for this Purpose, this Service Allows you to Communicate with the Servers Subscribed to a Topic using MessagingService:SubscribeAsync()
, if you want to fire it to all Servers, you would use MessagingService:PublishAsync()
.
Example:
MessagingService:SubscribeAsync("myTopic", function() -- Subscribes Server under a Topic
-- Data (has to be less than 1Kb)
end)
MessagingService:PublishAsync("myTopic") -- Fires Content to all Servers under the Topic
However, If you are Referring to Server only, you use what @MegabyteOfficial Provided with a RemoteEvent
to fire to All Clients if you want a specific screen or effect to show, preferablly to avoid latency.
So what you would do is:
Player got special item and sends RemoteEvent
to the Server —> Server sends message to all Servers and shows the effect/message —> all Servers show message?