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
 

Could someone help me decipher this script?

Previous Thread :: Next Thread 
gemerl20 is not online. gemerl20
Joined: 27 Aug 2008
Total Posts: 4682
21 Jan 2011 03:56 PM
Found it in a free model. It's boggling my mind, as I want to understand it but can't. Could someone help me out in figuring out what it means? I know what it does.



debris = game:GetService("Debris")
template = script.Template:Clone()
debris:AddItem(script.Template, 0.01)

focalPoint = script.Parent.Base
button = script.Parent.Button

function MeteorAdded(meteor)
meteor.Anchored = false
meteor.Touched:connect(function (hit)
if (hit.Transparency == 1) and (hit.CanCollide == false) then
return
end
if (hit.Name == "TerrainReformationMeteor") then
-- if (hit:FindFirstChild("Landed") == nil) and (math.random(1,2) == 2) then
return
-- end
end
if (meteor.Size.y > 75) then
wait(math.random())
end
--[[x = Instance.new("IntValue")
x.Name = "Landed"
x.Parent = meteor]]
meteor.Anchored = true
meteor.CanCollide = true
meteor.Velocity = Vector3.new(0,0,0)
meteor.Velocity = Vector3.new(0,0,0)
end)
end

function onChildAdded(child)
if (child.Name == "TerrainReformationMeteor") then
MeteorAdded(child)
end
end

function CallMeteors()
local meteors = math.random(30,70)
for i = 0, meteors do
local targetPosition = focalPoint.Position + Vector3.new(math.random(-175,175),0,math.random(-175,175))
local spawnPosition = focalPoint.Position + Vector3.new(math.random(-575,775),math.random(575,775),math.random(-575,775))
local shapeNum = (math.random(1,2) - 1)
local size = math.random(5,150)
local meteor = template:Clone()
meteor.Name = "TerrainReformationMeteor"
meteor.Size = Vector3.new(size,size,size)
--meteor.Shape = shapeNum
meteor.CFrame = CFrame.new(spawnPosition, targetPosition)
meteor.Velocity = meteor.CFrame.lookVector * math.random(50,150)
meteor.RotVelocity = Vector3.new(math.random(-50,50),math.random(-50,50),math.random(-50,50))
meteor.Parent = workspace
local floater = Instance.new("BodyForce")
floater.force = Vector3.new(0,meteor:GetMass() * (195+shapeNum),0)
floater.Parent = meteor
--[[local rotater = Instance.new("BodyAngularVelocity")
rotater.P = 7e20
rotater.angularvelocity = Vector3.new(math.random(-50,50),math.random(-50,50),math.random(-50,50))
rotater.Parent = meteor]]
debris:AddItem(meteor, 1200)
end
end

function CleanUp()
local children = script.Parent:GetChildren()
for i = 1, #children do
if (children[i] ~= script) then
debris:AddItem(children[i], 15)
children[i].Velocity = Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5))
children[i].BrickColor = BrickColor.new("Really black")
children[i].Material = Enum.Material.Foil
children[i].Anchored = false
end
end
end

function onClicked()
button.ClickDetector:Remove()
button.Transparency = 1
wait(math.random(3,5))
CallMeteors()
CleanUp()
end

workspace.ChildAdded:connect(onChildAdded)
button.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
AlsoHuman is not online. AlsoHuman
Joined: 27 Aug 2010
Total Posts: 116
21 Jan 2011 04:02 PM
Looks to me like it shoots meteors overhead the baseplate.
Report Abuse
gemerl20 is not online. gemerl20
Joined: 27 Aug 2008
Total Posts: 4682
21 Jan 2011 04:04 PM
Well, I know that. I said that I know what it does. But how does it work?
Report Abuse
drgn42 is not online. drgn42
Joined: 11 Feb 2010
Total Posts: 3231
21 Jan 2011 04:37 PM
does teh function callmeteors and then pwns yah
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