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
 

Re: Help with raycasting!?

Previous Thread :: Next Thread 
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 09:55 PM
So this is the wikis way of using raycasting. What this script does is it creates a "ray" and it is quickly created from the position of the tools handle to where my mouse clicked. What I'm TRYING to do is to make a ray that is created at the handle of my tools position and shoots out a BULLET like part that moves slower than the ray. How would I make this? I hope this explanation made sence. Please Help!?


wikis script...


local tool = script.Parent
local player = game:GetService("Players").LocalPlayer

tool.Equipped:connect(function(mouse)
print("Tool equipped!")

mouse.Button1Down:connect(function()
print("Mouse pressed!")
local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)

local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("Bright red")
beam.FormFactor = "Custom"
beam.Material = "Neon"
beam.Transparency = 0.25
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false

local distance = (tool.Handle.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

game:GetService("Debris"):AddItem(beam, 0.1)
end)
end)
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 10:04 PM
B
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 10:25 PM
b
Report Abuse
konichiwah1337 is not online. konichiwah1337
Joined: 16 Sep 2013
Total Posts: 1979
06 Feb 2016 10:29 PM
A bullet that moves >slower< than the ray itself?
I think you made a typo there.

You want the raycast to be like a tracer to a bullet right?
That's... a loooooot of algorithm.
Like.. I'm too tired to do about an hours with of algebra right now.
Sorry Q Q
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
06 Feb 2016 10:32 PM
@konich

OOH.
thanks dude! really cleared things up for me!
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
06 Feb 2016 10:32 PM
@konich

thanks for the helpful reply, we all appreciate it
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
06 Feb 2016 10:32 PM
@konich

Thanks dude!
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
06 Feb 2016 10:32 PM
wow cool konichaw

i will work on the algorithm now
Report Abuse
konichiwah1337 is not online. konichiwah1337
Joined: 16 Sep 2013
Total Posts: 1979
06 Feb 2016 10:33 PM
lmao...
you boys...
look familiar.
OH WAIT.
*checks skype*
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
06 Feb 2016 10:35 PM
I don't even have you on Skype.
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
06 Feb 2016 10:36 PM
What's a skype?
Report Abuse
Kizal0 is not online. Kizal0
Joined: 22 Sep 2015
Total Posts: 376
06 Feb 2016 10:36 PM
Lol david.


#code Some people call me savage. -Kizalo-
Report Abuse
konichiwah1337 is not online. konichiwah1337
Joined: 16 Sep 2013
Total Posts: 1979
06 Feb 2016 10:37 PM
GET ON SKYPE MY OLD CODER BUDDIES!!1
Report Abuse
konichiwah1337 is not online. konichiwah1337
Joined: 16 Sep 2013
Total Posts: 1979
06 Feb 2016 10:37 PM
Gubbins is online right now on skype, so get on and we can all re-unite after 3 years.
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
06 Feb 2016 10:38 PM
"GET ON SKYPE MY OLD CODER BUDDIES!!1"

wat
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
06 Feb 2016 10:39 PM
foreverdev is garbage tbh fam
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
06 Feb 2016 10:40 PM
yea foreverdev cant script like wtf he always ask stupid c question and i know java is better what a scrub

Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 10:42 PM
Okay so I'm having a problem. I'm trying to make a gun. When I add a touched event that kills the player when the bullet hits the player, it rarely works. Someone told me to use raycasting for this instead so can someone please help out? ;(
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 10:46 PM
b is there any other way besides making an "algorithm that would take an hour to make".
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
06 Feb 2016 10:47 PM
hmmm you can hack the matrix
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 10:51 PM
PLEASE HELP!
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 10:55 PM
Ok, so the way this gun shoots is what I'm trying to do...

http://www.roblox.com/Red-Hyperlaser-Gun-item?id=212296936
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 11:02 PM
bu
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
06 Feb 2016 11:22 PM
bum
Report Abuse
cooknunit is not online. cooknunit
Joined: 13 Oct 2012
Total Posts: 8
06 Feb 2016 11:23 PM
Some pretty painful math. Lookup "Roblox University" on YouTube. Net Gun parts 1 thru 3 stickmasterluke explains raycasting. Sort of...
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