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
 

Raycasting error

Previous Thread :: Next Thread 
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
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
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
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
RoyStanford is online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
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
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
29 Nov 2016 12:27 PM
I am hitting a part though.


AutoCarrot// Private Drive - Residents Only
Report Abuse
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
29 Nov 2016 01:10 PM
plz


AutoCarrot// Private Drive - Residents Only
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