|
| 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
|
  |
| 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
|
  |
| Joined: 16 Jul 2011 |
| Total Posts: 832 |
|
|
| 29 Jan 2015 10:52 AM |
| velocity is read-only aaand MyFunction = function() end |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2015 10:58 AM |
"velocity is read-only"?
So I would go;
MyFunction = function()
The function goes in ()? |
|
|
| Report Abuse |
|
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 29 Jan 2015 11:05 AM |
oops, add end after myfunction like this
while wait(3) do myfunction end |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 29 Jan 2015 11:27 AM |
because it's
Myfunction()
not
Myfunction |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 29 Jan 2015 11:30 AM |
yea ozzy cleared that up for me.
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
| |
|
|
| 29 Jan 2015 11:48 AM |
so your saying the function1 needs to stop before function2 starts? |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|