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 » Scripting Helpers
Home Search
 

Problem with mouse.Hit

Previous Thread :: Next Thread 
laurence122 is not online. laurence122
Joined: 17 Sep 2011
Total Posts: 135
01 Nov 2014 06:37 PM
I am having issues with using "mouse.Hit" here is the line of code :

script.Parent.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function(mouse)
if mouse.Hit ~= nil then
local pos = mouse.Hit
local clone = script.Parent.Handle:Clone()
clone.Name = 'Stick'
clone.CanCollide = false
clone.Anchored = true
clone.Position = Vector3.new(pos)
clone.Parent = workspace
end
end)
end)


When I put it into the game I get this.

1.1498642, 0, -31.3763351, 0.425794214, 0.637475729, -0.642124653, -1.4901163e-008, 0.70967114, 0.7045331, 0.904820144, -0.299986124, 0.302173823
07:33:38.874 - Players.Player1.Backpack.Tool.Script:10: bad argument #3 to 'Position' (Vector3 expected, got userdata)
07:33:38.875 - Script 'Players.Player1.Backpack.Tool.Script', Line 10
07:33:38.876 - Stack End
07:33:38.876 - Disconnected event because of exception


The values at the top are what I printed before setting the position.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
01 Nov 2014 06:40 PM
local pos = mouse.Hit
Should be:
local pos = mouse.Hit.p
Report Abuse
laurence122 is not online. laurence122
Joined: 17 Sep 2011
Total Posts: 135
01 Nov 2014 06:41 PM
Oh my gosh! Thank you so much!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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