|
| 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 |
|
|
|
| 01 Aug 2017 12:41 PM |
pls
- add 3.4k posts, ~connorhurtsu |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 12:43 PM |
asd
- add 3.4k posts, ~connorhurtsu |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 12:44 PM |
fufuflaga
- add 3.4k posts, ~connorhurtsu |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 12:46 PM |
this forum is not helpful
- add 3.4k posts, ~connorhurtsu |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 12:52 PM |
at all ^
- add 3.4k posts, ~connorhurtsu |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 01 Aug 2017 03:26 PM |
^ didnt work sadly
- add 3.4k posts, ~connorhurtsu |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 03:31 PM |
| where are you storing the module |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 04:22 PM |
in serverstorage
- add 3.4k posts, ~connorhurtsu |
|
|
| Report Abuse |
|
|
s3vvy
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 983 |
|
|
| 01 Aug 2017 04:34 PM |
local scripts can't access server storage
|
|
|
| Report Abuse |
|
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|