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
 

Lightning

Previous Thread :: Next Thread 
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
31 Oct 2015 06:17 PM
So I've made the initial "trunk" of the lightning, now how would I make branches that have their own "tree"
for i = 1, 20 do
lightning = Ray.new(nextpoint,nextpoint2)
lightning_trace(nextpoint,nextpoint2)
nextpoint=nextpoint2
nextpoint2 = Vector3.new(nextpoint.X+math.random(-5,5),nextpoint.Y-math.random(5,15), nextpoint.Z+math.random(-5,5))
local startbranch = nextpoint2
local branch = Vector3.new(nextpoint2.X+math.random(-5,5),nextpoint2.Y-math.random(5,15),nextpoint.Z+math.random(-5,5))
lightning = Ray.new(startbranch,branch)
lightning_trace(startbranch,branch)
end


You really want me to shake your hand?
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
31 Oct 2015 06:26 PM
lightning_ray = function(p1, p2)
local lightning = Ray.new(p1,p2)
local hit,endp = workspace:FindPartOnRay(lightning)
lightning_trace(p1,p2)
local nextpoint = Vector3.new(p1.X,p2.Y,p1.Z)
local nextpoint2 = Vector3.new(p1.X+math.random(-5,5),p2.Y-math.random(5,15),p1.Z+math.random(-5,5))
local startbranch = nextpoint2
local branch = Vector3.new(nextpoint2.X+math.random(-5,5),nextpoint2.Y-math.random(5,15),nextpoint.Z+math.random(-5,5))
for i = 1, 20 do
startbranch = startbranch
branch = branch
lightning = Ray.new(nextpoint,nextpoint2)
lightning_trace(nextpoint,nextpoint2)
nextpoint=nextpoint2
nextpoint2 = Vector3.new(nextpoint.X+math.random(-5,5),nextpoint.Y-math.random(5,15), nextpoint.Z+math.random(-5,5))
lightning = Ray.new(startbranch,branch)
lightning_trace(startbranch,branch)
startbranch = nil
startbranch = branch
branch = nil
branch = Vector3.new(startbranch.X+math.random(-5,5),startbranch.Y-math.random(5,15),startbranch.Z+math.random(-5,5))
end
end

print(lightning_ray(Vector3.new(0, 250, 0),Vector3.new(0, 240,0)))

I currently have that. But how would I make branches come off every single segment of the main bolt



You really want me to shake your hand?
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