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: How can I use RenderStepped as a function and not an event?

Previous Thread :: Next Thread 
Septamology is not online. Septamology
Joined: 20 Jun 2013
Total Posts: 2811
01 Jun 2015 12:18 AM
As in, a callable function?

For example

print('One')
game['Run Service'].RenderStepped:wait()
print('Two')

I heard that you can, but I'm just making sure.


Septamology | R$204 | Tx244,063 | RAP: 36,830
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
01 Jun 2015 12:19 AM
You clearly don't know how events work.
Report Abuse
Septamology is not online. Septamology
Joined: 20 Jun 2013
Total Posts: 2811
01 Jun 2015 12:22 AM
> You clearly don't know how events work.

I do know how events work, actually. I'm just wondering if there's any way to actually call upon an event as a function, and yield a result.


Septamology | R$204 | Tx244,063 | RAP: 36,830
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
01 Jun 2015 12:23 AM
Event:wait() --Waits until the event is fired. Returns the values the event was fired with

RBXScriptConnection Event:connect(callback function listener) --when Event is fired, callback function listener will be called with the arguments that the event is fired with. The userdata RBXScriptConnection that the function returns has a method :disconnect() which disconnects the event, and a bool value connected which indicates whether the listener is currently active, i.e. if it will be called when the event fires.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Jun 2015 12:24 AM
You did it right in your script.
wait is a method of signals that literally:
'Pauses the script until the event is fired and returns any arguments the event returns.'
Report Abuse
Septamology is not online. Septamology
Joined: 20 Jun 2013
Total Posts: 2811
01 Jun 2015 12:25 AM
Ahh, I see. I was just making sure. Thanks!


Septamology | R$204 | Tx244,063 | RAP: 36,832
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
01 Jun 2015 12:26 AM
Just do this:

function thisFunctionIsCalledWhenTheEventOccurs() --cool name
print("Render stepped")
end

game:GetService("RunService").RenderStepped:connect(thisFunctionIsCalledWhenTheEventOccurs)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Jun 2015 12:27 AM
But you aren't using "RenderStepped as a function", although with a bit of wrapping that can easily be possible so that:

game['Run Service'].RenderStepped()
Would just do game['Run Service'].RenderStepped:wait()
and game['Run Service'].RenderStepped(func)
Would just do game['Run Service'].RenderStepped:connect(func)
Report Abuse
Septamology is not online. Septamology
Joined: 20 Jun 2013
Total Posts: 2811
01 Jun 2015 12:28 AM
> Just do this:

function thisFunctionIsCalledWhenTheEventOccurs() --cool name
print("Render stepped")
end

game:GetService("RunService").RenderStepped:connect(thisFunctionIsCalledWhenTheEventOccurs)

I'm wanting to create an animation system, so I was just wondering if I could use RenderStepped just like wait(), I should have clarified. Thanks anyway.
Report Abuse
lateregistration is not online. lateregistration
Joined: 02 Apr 2013
Total Posts: 2630
01 Jun 2015 12:29 AM
@nQ

I dont think thats what he's asking for. For example in my scripts i do Game:GetService("RunService").RenderStepped:wait() to make animations run in 60 fps instead of around 30 when using wait().
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