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 » Game Design
Home Search
 

Re: script help needed

Previous Thread :: Next Thread 
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
09 Jul 2015 09:20 AM
does anyone know what i have to add to this script so that it will breakjoints to anything that touchs it. here is the script

local sp = script.Parent
local coil = sp.SecondaryCoil
local toroid = sp.Toroid
local segmentlength = 5
local varience = 5
local timetofade=.8

function raycast(spos,vec,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),sp)
if hit2~=nil and pos2 then
if hit2.Transparency>=.5 or hit2.Name=="Handle" then
local currentdist=currentdist-(pos2-spos).magnitude
return raycast(pos2,vec,currentdist)
end
end
return hit2,pos2
end

function zap(targetpos)
if targetpos then
local m = Instance.new("Model")
m.Name = "Lightning"
local lastpos=toroid.Position
local totalsegments=math.ceil(25/segmentlength)
local direction=(targetpos-toroid.Position).unit
local struck=false
for i=1,totalsegments do
if not struck then
local entropy=Vector3.new(varience*((math.random()*2)-3),varience*((math.random()*2)-3),varience*((math.random()*2)-3))
local newpos=toroid.Position+(direction*(60*(i/totalsegments)))+entropy
local hit,endpos=raycast(lastpos,(newpos-lastpos).unit,(lastpos-newpos).magnitude)
local l=Instance.new("Part")
l.CanCollide=false
l.Anchored=true
l.Material=("Neon")
l.BrickColor=BrickColor.new("Toothpaste")
l.formFactor="Custom"
l.Size=Vector3.new(.2,.2,.2)
l.CFrame=CFrame.new(lastpos,endpos)*CFrame.Angles(math.pi/2,0,0)*CFrame.new(0,-(lastpos-endpos).magnitude/2,0)
local mesh=Instance.new("CylinderMesh")
mesh.Scale=Vector3.new(.35,(lastpos-endpos).magnitude,.35)*5
mesh.Parent=l
delay(0,function()
for i=1,timetofade/(.1) do
wait(.1)
l.Transparency=i/(timetofade/(.1))
end
end)
l.Parent=m
if hit and hit.Parent~=nil then
struck=true
local h=hit.Parent:FindFirstChild("Humanoid")
if h then
h:TakeDamage(1)
end
end
toroid.Fire:Play()
lastpos=endpos
end
end
m.Parent=game.Workspace
game:GetService("Debris"):AddItem(m,1.5)
end
end

function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 1
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Torso")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end

while true do
local prob = math.random(1, 3)
local gg = findNearestTorso(toroid.Position)
if gg then
for i = 0, prob do
zap(gg.Position)
end
else
for i = 0, prob do
local xen = math.random(-600,600)
local yen = math.random(10,100)
local zen = math.random(-600,600)
local plrob = math.random(1,2)
if plrob == 1 then zap(Vector3.new(toroid.Position.X+xen,yen,toroid.Position.Z+zen)) end
end
end
wait(1)
end

I really need help with this
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
09 Jul 2015 09:27 AM
But did you make this.
Report Abuse
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
09 Jul 2015 10:03 AM
what does that have to do with adding a part to it ... i need answers not questions :l
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
09 Jul 2015 10:49 AM
I asked because no one will help you, if you just take a free modeled script, and ask someone to add stuff to it.
Report Abuse
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
09 Jul 2015 11:58 AM
if they wont answer this then they wont answer anything q.q i made 25 forums about this prob and still no legit answer
Report Abuse
XlAscensionlX is not online. XlAscensionlX
Joined: 17 Apr 2014
Total Posts: 872
09 Jul 2015 12:38 PM
local sp = script.Parent
local coil = sp.SecondaryCoil
local toroid = sp.Toroid
local segmentlength = 5
local varience = 5
local timetofade=.8

function raycast(spos,vec,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),sp)
if hit2~=nil and pos2 then
if hit2.Transparency>=.5 or hit2.Name=="Handle" then
local currentdist=currentdist-(pos2-spos).magnitude
return raycast(pos2,vec,currentdist)
end
end
return hit2,pos2
end

function zap(targetpos)
if targetpos then
local m = Instance.new("Model")
m.Name = "Lightning"
local lastpos=toroid.Position
local totalsegments=math.ceil(25/segmentlength)
local direction=(targetpos-toroid.Position).unit
local struck=false
for i=1,totalsegments do
if not struck then
local entropy=Vector3.new(varience*((math.random()*2)-3),varience*((math.random()*2)-3),varience*((math.random()*2)-3))
local newpos=toroid.Position+(direction*(60*(i/totalsegments)))+entropy
local hit,endpos=raycast(lastpos,(newpos-lastpos).unit,(lastpos-newpos).magnitude)
local l=Instance.new("Part")
l.CanCollide=false
l.Anchored=true
l.Material=("Neon")
l.BrickColor=BrickColor.new("Toothpaste")
l.formFactor="Custom"
l.Size=Vector3.new(.2,.2,.2)
l.CFrame=CFrame.new(lastpos,endpos)*CFrame.Angles(math.pi/2,0,0)*CFrame.new(0,-(lastpos-endpos).magnitude/2,0)
local mesh=Instance.new("CylinderMesh")
mesh.Scale=Vector3.new(.35,(lastpos-endpos).magnitude,.35)*5
mesh.Parent=l
delay(0,function()
for i=1,timetofade/(.1) do
wait(.1)
l.Transparency=i/(timetofade/(.1))
end
end)
l.Parent=m
if hit and hit.Parent~=nil then
struck=true
local h=hit.Parent:FindFirstChild("Humanoid")
if h then
h:BreakJoints()
end
end
toroid.Fire:Play()
lastpos=endpos
end
end
m.Parent=game.Workspace
game:GetService("Debris"):AddItem(m,1.5)
end
end

function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 1
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Torso")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end

while true do
local prob = math.random(1, 3)
local gg = findNearestTorso(toroid.Position)
if gg then
for i = 0, prob do
zap(gg.Position)
end
else
for i = 0, prob do
local xen = math.random(-600,600)
local yen = math.random(10,100)
local zen = math.random(-600,600)
local plrob = math.random(1,2)
if plrob == 1 then zap(Vector3.new(toroid.Position.X+xen,yen,toroid.Position.Z+zen)) end
end
end
wait(1)
end


Fixed it, next time follow the rules of the Forums and please only post the section you need help with, not a huge script asking us to do everything for you.

~XlAscensionlX [Graphic Design://Scripter://Developer://]
Report Abuse
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
09 Jul 2015 02:04 PM
I didn't know were it was suppost to go that why i posted whole script did not know this was against the rules.
Report Abuse
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
09 Jul 2015 02:15 PM
Only kills when it actually strikes somthing not if somthing runs into it so that did not help...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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