generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do you use ModuleScripts or whatever?

Previous Thread :: Next Thread 
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
10 Feb 2015 11:31 AM
I'm making a GUI that shows all the players in the game and I need a ModuleScript


-abs
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
10 Feb 2015 11:33 AM
If you don't know what a ModuleScript is, you don't need it.

It allows you to make modules and re-use code in multiple scripts and stuff. For example, some people have made interpolation modules, for interpolating things. eLunate made a time module, to get the current time in many measurements, and et cetera.
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
10 Feb 2015 11:34 AM
I thought ModuleScripts transferred data from Scripts to LocalScripts? Or am I getting confused?


-abs
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
10 Feb 2015 11:35 AM
I don't see why you need a module

Modules are used to return a value

Often a table of functions or a function

Example, if you put a moduleScript in ReplicatedStorage and put this inside the Module


local module = {}

function module.test()
print("This is a test")
end

function module.otherTest()
print("This is another test")
end

return module;



And in a script if you do

local blah = require(game.ReplicatedStorage.ModuleScript)
blah.test() -->This is a test
blah.otherTest() -->This is another test
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
10 Feb 2015 11:35 AM
You're talking about Remote Events and Remote Functions.
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
10 Feb 2015 11:36 AM
aha yes those! how do you use them? xd


-abs
Report Abuse
IthacaMedia is not online. IthacaMedia
Joined: 25 Jan 2014
Total Posts: 1337
10 Feb 2015 12:09 PM
@Jarod

Aww I was thinking of making a time module that does that xD.
Report Abuse
IthacaMedia is not online. IthacaMedia
Joined: 25 Jan 2014
Total Posts: 1337
10 Feb 2015 12:10 PM
But it doesn't seem available for me to take :P.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 12:26 PM
I never published my Time module, but the source is on my c9 and should work directly pasted into a moduleScript.

On that note, you want to use RemoteEvents dude. Never ever use a RemoteFunction unless it is imperitive that you wait for a response.
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
10 Feb 2015 12:27 PM
eLunate, Can I question what I would have to use that WOULD need a response?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 12:32 PM
Polling a client for if it is ready (Which should actually be sent straight from the client...)
Waiting for a client to complete an action is the most likely reason. This includes the server requesting for the client to preload an asset.
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
10 Feb 2015 12:35 PM
Ahhh Okay, I'll be using that then for Preload
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 12:42 PM
Basically, RemoteEvents will always be the best solution except for certain circumstances. They're a mimicry of the kind of 'reliable' RPCs you use in actual game development, and are much faster for most things.
Only use a RemoteFunction if you need to wait for the client/server to complete the request
Report Abuse
DominusAstra is not online. DominusAstra
Joined: 23 Jun 2014
Total Posts: 12468
10 Feb 2015 12:45 PM
So, how to use them?

-abs's alt
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 12:49 PM
Server:
[void] RemoteEvent:FireServer(...)
[Event]RemoteEvent.OnServerEvent >> (Player, ...)

Client:
[void] RemoteEvent:FireClient(Player, ...)
[Event]RemoteEvent:FireAllClients(...)
[Event]RemoteEvent.OnClientEvent >> (...)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 12:49 PM
Trust me. I just woke up again so uh don't shoot...

[void] RemoteEvent:FireAllClients(...)*
Report Abuse
DominusAstra is not online. DominusAstra
Joined: 23 Jun 2014
Total Posts: 12468
10 Feb 2015 12:53 PM
wat.

i'm so confused
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 12:55 PM
Void just means a function that doesn't return anything.
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
10 Feb 2015 12:57 PM
ok, so...

how would i use remoteevents to uhh..

transfer a table with a full list of players in the game to a localscript so i can display it on my gui?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
10 Feb 2015 12:58 PM
Why not just do game.Players:GetPlayers()?
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
10 Feb 2015 12:59 PM
Because in each little frame showing the player i'm doing it like this:

p[1]
p[2]

etc
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 01:05 PM
^
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Feb 2015 01:05 PM
Wait no that really doesn't make sense why aren't you using game.Players:GetPlayers()
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
10 Feb 2015 01:08 PM
wait

if i do

plrs = game.Players:GetPlayers()

can i do

plrs[1] and stuff
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
10 Feb 2015 01:09 PM
also i need it to remove people that leave so watttttttt
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image