Draekin
|
  |
| Joined: 25 Jan 2012 |
| Total Posts: 208 |
|
|
| 29 Mar 2016 09:57 PM |
| I have a tool and it requires() fine in Studio. But when I try it in-game I get an error saying 'require(assetId) cannot be used in client'. |
|
|
| Report Abuse |
|
|
Encladeus
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 3839 |
|
| |
|
|
| 29 Mar 2016 10:02 PM |
I'm guessing no because tool scripts might need to do LocalPlayer:GetMouse() which can only be done in LocalScripts, and require(assetid) can only be done in ServerScripts. Maybe parts of it can be in a PrivateModule and use RemoteFunctions
|
|
|
| Report Abuse |
|
|
|
| 29 Mar 2016 10:02 PM |
If it says it can't be used in the client then it can't be used in the client. *sigh*
|
|
|
| Report Abuse |
|
|
1080pHD
|
  |
| Joined: 10 May 2012 |
| Total Posts: 1192 |
|
|
| 29 Mar 2016 10:15 PM |
That is because you are not allowed to require a module from its asset id in a localscript. You'll need to place the module in the game and require from there. |
|
|
| Report Abuse |
|
|
Draekin
|
  |
| Joined: 25 Jan 2012 |
| Total Posts: 208 |
|
|
| 29 Mar 2016 10:17 PM |
| If that's the case would it be possible to use a server script to require and then link or refer that to the localscript which would have needed to require the private module in the first place? |
|
|
| Report Abuse |
|
|
adam1717
|
  |
| Joined: 07 May 2011 |
| Total Posts: 960 |
|
|
| 29 Mar 2016 10:22 PM |
| Store a local script inside the Module then clone it |
|
|
| Report Abuse |
|
|
1080pHD
|
  |
| Joined: 10 May 2012 |
| Total Posts: 1192 |
|
|
| 29 Mar 2016 10:23 PM |
| I hope I understand correctly, do you mean requiring a module and putting it somewhere in the game so that the localscript can require the parented module? |
|
|
| Report Abuse |
|
|
1080pHD
|
  |
| Joined: 10 May 2012 |
| Total Posts: 1192 |
|
|
| 29 Mar 2016 10:25 PM |
Whoops.
well I meaning requiring a module that returns another module. |
|
|
| Report Abuse |
|
|
1080pHD
|
  |
| Joined: 10 May 2012 |
| Total Posts: 1192 |
|
| |
|
Draekin
|
  |
| Joined: 25 Jan 2012 |
| Total Posts: 208 |
|
|
| 29 Mar 2016 10:31 PM |
| Well yeah, now my setup is like this: There's a ModuleScript Within workspace that requires(assetId) and returns that. Now My tool would require the module script within Workspace. Do you think that would work? The module script that requires the asset isn't in any local environment anymore. |
|
|
| Report Abuse |
|
|
1080pHD
|
  |
| Joined: 10 May 2012 |
| Total Posts: 1192 |
|
|
| 29 Mar 2016 10:38 PM |
Yes, that will work.
I've even tested something like this before myself. |
|
|
| Report Abuse |
|
|
Draekin
|
  |
| Joined: 25 Jan 2012 |
| Total Posts: 208 |
|
|
| 29 Mar 2016 10:42 PM |
| Hey uh, I tried it and it still returns the same error. Why? The one that fetches the assetId isn't in the tool anymore |
|
|
| Report Abuse |
|
|
1080pHD
|
  |
| Joined: 10 May 2012 |
| Total Posts: 1192 |
|
|
| 30 Mar 2016 07:57 AM |
Put this in the localscript: require(workspace.FirstModule.SecondModule)
Are you sure the module you're having errors requiring is in workspace? |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2016 09:05 AM |
This thread annoys me.
You can't require a module by ID in a LocalScript.
"Well yeah, now my setup is like this: There's a ModuleScript Within workspace that requires(bobetId) and returns that." You can't do that because ModuleScripts behave as LocalScripts when required from a LocalScript.
"If that's the case would it be possible to use a server script to require and then link or refer that to the localscript which would have needed to require the private module in the first place?" In 4 out of 5 cases that won't work. You can't send things like functions, userdata, and so forth.
"Store a local script inside the Module then clone it" That would defeat the purpose of the private module concept.
You can't use private modules on the client, no matter what. The only real purpose for private modules is to allow other people to use them on the server without them being able to steal them unless they are 31337 h4x0rz or at least know what they're doing.
|
|
|
| Report Abuse |
|
|
|
| 30 Mar 2016 09:24 AM |
@jarod what about remotefunctions like I told them to do and they ignored
|
|
|
| Report Abuse |
|
|