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: make a function u can run

Previous Thread :: Next Thread 
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 10:49 AM
So how do i word this the part where your function =

My function = script.parent.velocity = vector3.new(10,0,0)
While wait(3)

Run "My Function"


I did that wrong, how do I make work?
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
29 Jan 2015 10:51 AM
every line you wrote is wrong dude

wiki.roblox.com
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
29 Jan 2015 10:52 AM
velocity is read-only aaand MyFunction = function() end
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 10:58 AM
"velocity is read-only"?

So I would go;

MyFunction = function()


The function goes in ()?
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:01 AM
ughh
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
29 Jan 2015 11:04 AM
I fix it for you. and yes, every line is wrong.

function myfunction()
Script.Parent.Velocity = vector3.new(10,0,0)
end
while wait(3) do
myfunction
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Jan 2015 11:05 AM
Velocity is not read only, he doesn't know what he's talking about
Report Abuse
Fatalizer is not online. Fatalizer
Joined: 28 Aug 2011
Total Posts: 1520
29 Jan 2015 11:05 AM
You forgot an end.



〔 :{❖}: I want a girl which name doesn't end with .jpg :{❖}: 〕
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
29 Jan 2015 11:05 AM
oops, add end after myfunction like this

while wait(3) do
myfunction
end
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:20 AM
Thanks guys, yea I didn't figure I did it right the first time (Recently started learning how to script)

So if I wanted to make another function I would go
ex;

function myfunction()
Script.Parent.Transparency = 0.5
end
while wait(3) do
myfunction
end



So for functions I need

Function Myfunction()
-INSERT FUNCTION HERE-
end
while wait(10) do
myfunction
end

??

Yay!
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
29 Jan 2015 11:24 AM
"Function Myfunction()
-INSERT FUNCTION HERE-
end
while wait(10) do
myfunction
end"

function*

Myfunction()*
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:26 AM
wait wait i have

function Myfunction()
script.Parent.Velocity = Vector3.new(10,0,0)
end
while wait(6) do
Myfunction
end

but when i run it the script thing says the last end dont work (its red)
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
29 Jan 2015 11:27 AM
because it's

Myfunction()

not

Myfunction
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:27 AM
@ozzy k thx
Report Abuse
TheRobloxian909 is not online. TheRobloxian909
Joined: 08 Aug 2013
Total Posts: 2444
29 Jan 2015 11:28 AM
function Myfunction()
script.Parent.Velocity = Vector3.new(10,0,0)
end
while wait(6) do
Myfunction()
end
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:30 AM
yea ozzy cleared that up for me.

Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
29 Jan 2015 11:36 AM
functions should be used for running big code which you use over alot or
code that you want to be edited slightly when given infomation example:

function Add(num1,num2)
return num1+num2
end

print(Add(9,10)) -- 19
print(Add1,1)) -- 2



Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:40 AM
Okay okay I know I ask a lot of questions... one day I'll be able to script :p

Anyways say I wanted 2 functions that I could run... would It be like this?

function Myfunction1()
script.parent.velocity = vector3.new(10,0,0)
end
function Myfunction2()
script.parent.velocity = vector3.new(-10,0,)

while wait(6) do
Myfunction1()
end

while wait(30) do
Myfunction2()
end

Did okay? Did horrible? I tried ;c
Report Abuse
TheRobloxian909 is not online. TheRobloxian909
Joined: 08 Aug 2013
Total Posts: 2444
29 Jan 2015 11:41 AM
Capitalize 'Parent'

9/10
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
29 Jan 2015 11:42 AM
while wait(6) do
Myfunction1()
end

while wait(30) do
Myfunction2()
end

Alright the problem with this is that the first loop needs to finish before the second one below it can run

Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:45 AM
legendary explain?
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:48 AM
so your saying the
function1 needs to stop before function2 starts?
Report Abuse
DarkenedCodex is not online. DarkenedCodex
Joined: 07 Sep 2014
Total Posts: 816
29 Jan 2015 11:51 AM
how does 1 do that? ^
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
29 Jan 2015 12:41 PM
so you should know that scripts go from top to bottom
print("1")
print("2")
print("3")
print("4")

when you do the first loop which never ends it will never let the other stuff below it run since the code is waiting for the loop to end

to fix this problem requires some complex stuff
http://wiki.roblox.com/index.php?title=Function_dump/Coroutine_manipulation

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