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
 

Re: Raycasting help

Previous Thread :: Next Thread 
StrikerBOY606 is not online. StrikerBOY606
Joined: 25 Oct 2010
Total Posts: 747
11 May 2013 04:47 PM
I've read through the Raycasting Wiki and I'm just a little stuck on how to make it so the bullet shoots from the barrel to where the mouse cursor is.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
11 May 2013 04:50 PM
You set the direction in the raycast script.Make a loop for that direction.
Report Abuse
StrikerBOY606 is not online. StrikerBOY606
Joined: 25 Oct 2010
Total Posts: 747
11 May 2013 04:58 PM
I am COMPLETELY new to Raycasting and all I got so far is:

local ray = Ray.new()

xD
Report Abuse
StrikerBOY606 is not online. StrikerBOY606
Joined: 25 Oct 2010
Total Posts: 747
11 May 2013 05:29 PM
Ok, this is what I have got so far:

local tool = script.Parent
local player
tool.Equipped:connect(function(mouse)
player = tool.Parent
mouse.Button1Down:connect(function()
local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300)
local hit, position = game.Workspace:FindPartOnRay(ray, player)
if hit then
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(math.random(0, 10))
--Make it fire from the handle to where the mouse cursor is
end
end
end)
end)

How would I make it travel from the handle to the mouse cursor?
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