|
| 29 Nov 2016 12:12 PM |
function CreateRay(Position) print(Position.X) print(Position.Y) local Rey = Camera:ScreenPointToRay(Position.X, Position.Y) local Part, Position = workspace:FindPartOnRay(Rey, Player.Character, false, true) print(Part.Name) end
494 465 18:11:47.254 - Players.Player1.Backpack.BasicGun.LocalScript:52: attempt to index local 'Part' (a nil value) 18:11:47.255 - Stack Begin 18:11:47.256 - Script 'Players.Player1.Backpack.BasicGun.LocalScript', Line 52 - global CreateRay 18:11:47.257 - Script 'Players.Player1.Backpack.BasicGun.LocalScript', Line 41 18:11:47.257 - Stack End
I am clicking on a part, any ideas?
AutoCarrot// Private Drive - Residents Only |
|
|
| Report Abuse |
|
|
|
| 29 Nov 2016 12:14 PM |
(The reason I'm doing it like this is so I can use UIS, and make it smart phone compatible.
AutoCarrot// Private Drive - Residents Only |
|
|
| Report Abuse |
|
|
|
| 29 Nov 2016 12:20 PM |
If it can't find the part it just means it never hit anything. Just add an if statement
if Part then print(Part.Name) else print("the ray didn't hit anything") end |
|
|
| Report Abuse |
|
|
|
| 29 Nov 2016 12:27 PM |
I am hitting a part though.
AutoCarrot// Private Drive - Residents Only |
|
|
| Report Abuse |
|
|
|
| 29 Nov 2016 01:10 PM |
plz
AutoCarrot// Private Drive - Residents Only |
|
|
| Report Abuse |
|
|