|
| 01 Mar 2015 07:15 PM |
local RoleSetIds = { Civilian = 16645224, Convert = 16649775, Freelancer = 16649777, Sentinel = 16649769, Lieutenant = 16649764, Ambassador = 16649757, General = 16649754, Commodore = 16649753, }
local API = { promote = game.ReplicatedStorage:WaitForChild("promoteUser") }
API.promote:InvokeServer(4858566,RoleSetIds['Commodore'])
How could I modify this so I could just do this instead of the InvokeServer stuff? I was just assuming modulescripts, but anyone have any ideas other than making it a function? This will be public to use, and I'd like to make it as simple as possible. API.promote(4858566,RoleSetIds['Commodore'])
"no you're being stupid." -General Astrochemistry |
|
|
| Report Abuse |
|
|
Froast
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 3134 |
|
|
| 01 Mar 2015 07:35 PM |
um wat i dont even know what your question is |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 07:39 PM |
How could I modify this so I could just do this instead of the InvokeServer stuff? I was just assuming modulescripts, but anyone have any ideas other than making it a function? This will be public to use, and I'd like to make it as simple as possible. API.promote(4858566,RoleSetIds['Commodore']) [2]
"no you're being stupid." -General Astrochemistry |
|
|
| Report Abuse |
|
|
gerov
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 5504 |
|
|
| 01 Mar 2015 07:42 PM |
If you don't want to invoke anything, why not just make a function inside the same script?
If that is what you mean.
Why don't you take a seat over there? |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 07:43 PM |
If you don't want to invoke anything, why not just make a function inside the same script?
I'm trying not to utilize functions for this.
"no you're being stupid." -General Astrochemistry |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 07:43 PM |
Not possible.
The fact you're using InvokeServer leads me to believe you're using a localscript, and you cannot use HTTPService (which is required in the ingame promotion process) in a localscript. Only server scripts. You must use a localscript, and a RemoteEvent/RemoteFunction to have any sort of interaction with the server to secure your promotion/demotion interface. |
|
|
| Report Abuse |
|
|
Froast
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 3134 |
|
|
| 01 Mar 2015 07:43 PM |
apologies, I didn't read that carefully enough
you could either do
promote = function(...) game.ReplicatedStorage:WaitForChild'promoteUser':InvokeServer(...) end
or something fancy with metatables (which I'll look into) |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 07:45 PM |
@Poly, I know. I'm trying to modify something in here
local API = { promote = game.ReplicatedStorage:WaitForChild("promoteUser") }
so that they don't need to type Api.promote:InvokeServer(userId,rolesetId) for everything and can just do Api.promote(userId,rolesetId)
without functions, primarily to keep it neat.
"no you're being stupid." -General Astrochemistry |
|
|
| Report Abuse |
|
|
Froast
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 3134 |
|
|
| 01 Mar 2015 07:47 PM |
derp sorry I'm totally misinterpreting your question
you can hide the InvokeServer thing but the server is the only thing that can execute HttpService requests (like Poly said) |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 07:52 PM |
why would you do that if what you'd essentially be doing is the InvokeServer?
Why not cut out the unnecessary parts you're trying to create and just do it, you act like you're not going to be able to to properly document your work. Regardless you're going to have to call InvokeServer, you may as well just do it if theres no extra processing required, doing what you want is inefficient, nothing about it "looks good" in my opinion.
Though, if you'd really like:
local RemoteFunctions = game:GetService("ReplicatedStorage"):WaitForChild("RemoteFunctionContainer") local API = {}
setmetatable(API, { __index = function(index) if RemoteFunctions:FindFirstChild(index) then return function(...) RemoteFunctions[index]:InvokeServer(...) end end end}) |
|
|
| Report Abuse |
|
|
| |
|