|
| 20 Feb 2013 10:20 AM |
I'm trying to use a BindableEvent to call something of a 'subroutine' in my scripts. Only problem is, the connection isn't working. Here's my script:
function onFire(obj,ox,oy,nx,ny) local time=0 local addx=nx-ox local addy=ny-oy while time<1 do time=time+.01 nofs=math.sin(time*3.14159/2) obj.CFrame=vector3.New(ox+nofs*addx,oy+nofs*addy,obj.Position.Z) wait(.01) end end
game.Workspace.move.Event:connect(onFire)
And the error:
11:18:33 - Workspace.Mover:13: attempt to index field 'move' (a function value) 11:18:33 - Script "Workspace.Mover", Line 13 11:18:33 - stack end
I haven't worked much with BindableEvents, so i'm not entirely sure what i'm doing wrong. |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2013 10:21 AM |
| Oh, i forgot to add; 'move' is the bindableevent in game.Workspace. |
|
|
| Report Abuse |
|
|
cart6157
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 2194 |
|
| |
|
|
| 20 Feb 2013 10:29 AM |
| I don't get it. What is it that you find so amusing? |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 20 Feb 2013 10:37 AM |
| Put the Script in the BindableEvent, and then use script.Parent |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2013 10:46 AM |
| changed it to have the script inside the event, but i'm still getting the same error. 'Attempt to index field 'move' (a function value)'. |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2013 10:48 AM |
| edit: now the script isn't immediatley throwing out the error, it's only being thrown when i attempt to activate the event. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 20 Feb 2013 10:49 AM |
change:
*snip*game.Workspace.move.Event:co*snip*
to
script.Parent.Event |
|
|
| Report Abuse |
|
|
| |
|
| |
|