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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Question

Previous Thread :: Next Thread 
beastmodetime14 is not online. beastmodetime14
Joined: 01 Mar 2013
Total Posts: 586
04 Apr 2014 11:44 PM
I am a new scripter and was wondering how to make the damage of an Explosion random. Thank you
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
04 Apr 2014 11:47 PM
math.random(1,x)
Report Abuse
beastmodetime14 is not online. beastmodetime14
Joined: 01 Mar 2013
Total Posts: 586
04 Apr 2014 11:49 PM
Here is my script by the way.


while true do
wait(2)
e = Instance.new("Explosion", Workspace)
e.ExplosionType = "Craters"
e.Position = Vector3.new(0 , 10, 0)
wait(1)
e = Instance.new("Explosion", Workspace)
e.ExplosionType = "Craters"
e.Position = Vector3.new(10, 5, 10)
wait(1)
end

Report Abuse
beastmodetime14 is not online. beastmodetime14
Joined: 01 Mar 2013
Total Posts: 586
04 Apr 2014 11:51 PM
Where would i put that in my script?
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
05 Apr 2014 12:06 AM
range = 5 --Change to how far away one needs to be

while true do
wait(2)
e = Instance.new("Explosion", Workspace)
e.ExplosionType = "Craters"
e.Position = Vector3.new(0 , 10, 0)
for _,v in pairs(Workspace:GetChildren()) do
if v:findFirstChild("Humanoid") and (v.Torso.Position - e.Position).magnitude >= range then
local hum = v:findFirstChild("Humanoid")
hum:TakeDamage(math.random(1,20)) --Change here
end
end
wait(1)
ex = Instance.new("Explosion", Workspace)
ex.ExplosionType = "Craters"
ex.Position = Vector3.new(10, 5, 10)
for _,o in pairs(Workspace:GetChildren()) do
if v:findFirstChild("Humanoid") and (o.Torso.Position - ex.Position).magnitude >= range then
local hum = v:findFirstChild("Humanoid")
hum:TakeDamage(math.random(1,20)) --Change here
end
end
wait(1)
end
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:08 AM
Why do you guys immediately help them but not me?
Report Abuse
Club24Hour is not online. Club24Hour
Joined: 23 Oct 2011
Total Posts: 1795
05 Apr 2014 12:09 AM
Their questions might be a bit easier
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
05 Apr 2014 12:09 AM
bcus I can choose who i want to help
Report Abuse
beastmodetime14 is not online. beastmodetime14
Joined: 01 Mar 2013
Total Posts: 586
05 Apr 2014 12:11 AM
Thank you so much.
Report Abuse
beastmodetime14 is not online. beastmodetime14
Joined: 01 Mar 2013
Total Posts: 586
05 Apr 2014 12:16 AM
The output says on line 9 attempt to compare nil with number
Report Abuse
beastmodetime14 is not online. beastmodetime14
Joined: 01 Mar 2013
Total Posts: 586
05 Apr 2014 12:17 AM
Never mind fixed it
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