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: RemoteFunction question?

Previous Thread :: Next Thread 
BIoodraven is not online. BIoodraven
Joined: 14 Sep 2014
Total Posts: 11981
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 is not online. 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
BIoodraven is not online. BIoodraven
Joined: 14 Sep 2014
Total Posts: 11981
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 is not online. 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
BIoodraven is not online. BIoodraven
Joined: 14 Sep 2014
Total Posts: 11981
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
Polymorphic is online. Polymorphic
Joined: 15 Dec 2010
Total Posts: 8583
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 is not online. 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
BIoodraven is not online. BIoodraven
Joined: 14 Sep 2014
Total Posts: 11981
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 is not online. 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
Polymorphic is online. Polymorphic
Joined: 15 Dec 2010
Total Posts: 8583
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
CrescentJade is not online. CrescentJade
Joined: 07 Jul 2010
Total Posts: 5494
01 Mar 2015 07:59 PM
Metatable?
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