BindableEvents
ModuleScripts
_G
can be used to send Data from Script to Script
_G
is a Global Variable you can use to send Data between Scripts
_G.Data = "string"
print(_G.Data) -- "string"
Note that this Method can only be used within the Context Level of your Script. So if you have a Variable on the Client, that Said variable can only be used on the Client.
BindableEvents
are basically Custom Events, unlike RemoteEvents
they dont send Data between Context Levels, You would need to set up the Event and fire it manually:
Bindable.Event:Connect(function()
-- code
end)
Bindable:Fire() -- Fires Bindable Event
ModuleScripts
can be used for both Server
and Client
, you would use require()
access the Module, Depending on where you require()
it, that’s where it would run.
local module = {}
module.Number = 1
return module
local module = require(ModuleScript)
print(module.Number) -- "1"
If you intend to fire something to ALL clients (as in Players), use a RemoteEvent
, set it up on the Client, and use the FireAllClients
method to Fire to All Players. which would basically be what @7z99 said here:
Client Event -> Server ( Only Server can fire this Event) -> Firing To All Clients
Or, For a Server wide effect, You would Set it up on the Server, and Fire it on the Client (However for this case, you can just use the Server)
Links Provided if you would Like to know more:
ModuleScript
_G
BindableEvent
RemoteEvent
@tuxe_t
For your case of a Time Trial game, It would be best to Manage Times on the Server and Effects on the Client, this is so hackers cant just change the Time, or suddenly have a Absurd Score, It is best to Never trust the client with specific endeavors for this reason.
It is also best to consider Securing your RemoteEvents
as they can be fired quite Easily.