Akbarr
|
  |
| Joined: 02 Nov 2012 |
| Total Posts: 5547 |
|
|
| 19 May 2013 11:35 AM |
How can I check if part or position are nil without it erroring? It errors WHEN it gets the values, that means you can't do "if hit then" or "if game.Workspace:FindPartOnRay(lalal,lalal)"
I need to figure out how to stop the ray at a certain height or just have the function forfeit before it reaches nil.
local hit, position = game.Workspace:FindPartOnRay(part,position) |
|
|
| Report Abuse |
|
|
Akbarr
|
  |
| Joined: 02 Nov 2012 |
| Total Posts: 5547 |
|
|
| 19 May 2013 11:41 AM |
Bump ~Sharpshooter26/firemonkSEE |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 19 May 2013 11:42 AM |
| Your error is in the actual function call. The second argument is not a position. |
|
|
| Report Abuse |
|
|
Akbarr
|
  |
| Joined: 02 Nov 2012 |
| Total Posts: 5547 |
|
|
| 19 May 2013 11:46 AM |
By that do you mean that the script is attempting define something nil or are you saying I defined the incorrectly in the script? ~Sharpshooter26/firemonkSEE |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 19 May 2013 11:49 AM |
"local hit, position = game.Workspace:FindPartOnRay(part,position)"
Notice the two things you're giving that function (part, position). You don't give it those things. You have to give it a ray. For example:
local ray = Ray.new(position, direction) local hit, position = game.Workspace:FindPartOnRay(ray) |
|
|
| Report Abuse |
|
|