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
 

someone explain why this module script isn't working

Previous Thread :: Next Thread 
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 12:40 PM
okay so i have bricks that fall from the sky(theyre located in serverstorage) but i didnt want to set the value on each and every one(theyre grouped up in a model), so i put the value in a ModuleScript named settings.

heres the script in the bricks:
amnt = script.Parent.Parent.Settings.Amount --how much you get for it
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Cash")
if (score~=nil) then
score.Value = score.Value + amnt
end
end
end
script.Parent:remove()
end
end

script.Parent.Touched:connect(onTouched)


and heres the module script. it's very short

local module = {
['Settings'] = {
['Amount'] = 20


this does not work. any thoughts?



- add 3.4k posts, ~connorhurtsu
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 12:41 PM
pls


- add 3.4k posts, ~connorhurtsu
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 12:43 PM
asd


- add 3.4k posts, ~connorhurtsu
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 12:44 PM
fufuflaga


- add 3.4k posts, ~connorhurtsu
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 12:46 PM
this forum is not helpful


- add 3.4k posts, ~connorhurtsu
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 12:52 PM
at all ^


- add 3.4k posts, ~connorhurtsu
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
01 Aug 2017 12:53 PM
you can't script is the reason, and second, this isn't LMAD. not everyone is 100% always online and ready to post every 5 seconds.

you have to require the module too.


- RL
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 01:02 PM
o well um

the whole point of this subforum is to be able to ask questions and get advice about certain scripts

do you have autism






- add 3.4k posts, ~connorhurtsu
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
01 Aug 2017 01:05 PM
sorry, what I was just trying to say stop bumping every few minutes.

try this, what you did wrong was you didn't require the module script

amnt = require(script.Parent.Parent.Settings).Amount


- RL
Report Abuse
Kiriot22 is not online. Kiriot22
Joined: 19 Jul 2015
Total Posts: 226
01 Aug 2017 01:07 PM
Module
-----------------
local Settings = {
['Amount'] = 20
}
return Settings

Script
-----------------
amnt = require(script.Parent.Parent)["Amount"]


Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 01:08 PM
i tried it, but it didnt work. i guess my module script is wrong



but thanks anyway for trying to help


- add 3.4k posts, ~connorhurtsu
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
01 Aug 2017 01:09 PM
yeah your module shouldn't be setup like that anyway. It should be

module = {
["Amount"] = 20
}




- RL
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 01:12 PM
since none of this is working, i guess i could do a Value instead of a module


- add 3.4k posts, ~connorhurtsu
Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
01 Aug 2017 02:03 PM
inside module script: local module = { ["Amount"] = 20 } return module inside local script: local mTable = ######################### ## ###### = module's table print(mTable.Amount)
Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
01 Aug 2017 02:04 PM
inside module script:

local module = {
["Amount"] = 20
}

return module


inside local script:

local mTable = require (moduleScript) -- mTable = module's table
print(mTable.Amount)


Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 03:26 PM
^ didnt work sadly


- add 3.4k posts, ~connorhurtsu
Report Abuse
ExecutionMode is not online. ExecutionMode
Joined: 12 Jan 2015
Total Posts: 380
01 Aug 2017 03:31 PM
where are you storing the module
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
01 Aug 2017 04:22 PM
in serverstorage


- add 3.4k posts, ~connorhurtsu
Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
01 Aug 2017 04:34 PM
local scripts can't access server storage


Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
01 Aug 2017 04:35 PM
Yes, they can.


Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
01 Aug 2017 04:36 PM
OP, you don't need to involve any clients anyway. Just require the module from the server.


Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
01 Aug 2017 04:37 PM
A container whose contents are only on the server. This service is intended to be a secure replacement for the Lighting service as a place to store ROBLOX objects. If you're looking for a service which can be used both by the server and clients, see ReplicatedStorage.
The advantage to storing objects server-side only is that network traffic will not be spent on transmitting these objects to players, which could be useful if, for instance, a place has several maps with a lot of parts that would otherwise all have to be downloaded by the client when the player joins a place, but only one is used at a time. The disadvantage is that LocalScripts will not be able to access the contents of this service.

The disadvantage is that LocalScripts will not be able to access the contents of this service.

The disadvantage is that LocalScripts will not be able to access the contents of this service.


Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
01 Aug 2017 04:40 PM
Module scripts can be ran by local scripts or server scripts.

There is no difference, other than local and server differences.


Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
01 Aug 2017 04:40 PM
Accessing the contents of a service is different from accessing the service.

Accessing the contents of a service is different from accessing the service.

Accessing the contents of a service is different from accessing the service.


Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
01 Aug 2017 04:43 PM
was it really necessary to make that distinction? all you do is confuse anybody who reads this thread because they'll think that they can access the contents of server storage

there's literally no other use for server storage than for accessing it's contents
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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