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: Explode on Touch?

Previous Thread :: Next Thread 
DarkFlameCrimsonXana is not online. DarkFlameCrimsonXana
Joined: 24 May 2012
Total Posts: 47
03 May 2015 10:49 AM
Hi I've mad a new script :
"local Part = script.Parent
function onTouch (Brick)
local Player =
Brick.Parent:findFirstChild("Humanoid")
Player.Health = Player.Health - 100

end
Part.Touched:connect(onTouch)"

but I want it to Explode the player I don't know how to do it.


Please explain how the script you're showing works, Because I'm a beginner at Lua
Report Abuse
Coolmonkey4eva is not online. Coolmonkey4eva
Joined: 29 Feb 2012
Total Posts: 73
03 May 2015 11:45 AM
The way your function is set up, it will never explode. Your function needs to create an explosion, which is an actual instance, and they explode as soon as they are in existance. So, instead of making the player's health at 0, try putting this in your function:

Instance.new(Explosion)

If this doesn't work, try explosion in lower-case (not caps)

Hope this helps.
Report Abuse
Coolmonkey4eva is not online. Coolmonkey4eva
Joined: 29 Feb 2012
Total Posts: 73
03 May 2015 11:48 AM
I just read the rest of your post(lol) so here is how the script should look like:

local Part = script.Parent
function onTouch(Brick)
Instance.new(Explosion)
end

Part.Touched:connect(onTouch)

(This script basically says to create an explosion when a player touches it)
Report Abuse
GhostSailor is not online. GhostSailor
Joined: 02 Jul 2010
Total Posts: 1913
03 May 2015 12:06 PM
Pls no, cool.

local Part = script.Parent
function onTouch(Brick)
local exp = Instance.new(Explosion)
exp.Parent = game.Workspace
exp.Position = Brick.Position
exp.ExplosionType = "NoCraters"
exp.DestroyJointRadiusPercent = 50
exp.BlastRadius = 6
exp.BlastPressure = 500000
end

That sets every property of an explosion. Position and Parent are the only ones you really need, but you can toy with the others.

Lord of all things, breaded and unbreaded.
Report Abuse
GhostSailor is not online. GhostSailor
Joined: 02 Jul 2010
Total Posts: 1913
03 May 2015 12:07 PM
Whoops, forgot quotes.

local Part = script.Parent
function onTouch(Brick)
local exp = Instance.new("Explosion")
exp.Parent = game.Workspace
exp.Position = Brick.Position
exp.ExplosionType = "NoCraters"
exp.DestroyJointRadiusPercent = 50
exp.BlastRadius = 6
exp.BlastPressure = 500000
end

Lord of all things, breaded and unbreaded.
Report Abuse
DarkFlameCrimsonXana is not online. DarkFlameCrimsonXana
Joined: 24 May 2012
Total Posts: 47
03 May 2015 07:13 PM
Thank you Cool and ghost, although both of ur scripts didn't work, so I combined them together in the way I understand and i tworked.
this is the script :
"local Part = script.Parent
function onTouch(Brick)
local Player =
Brick.Parent:findFirstChild("Humanoid")
local E = Instance.new("Explosion")
E.Parent = script.Parent
E.Position = Brick.Position
E.ExplosionType = "NoCraters"
E.DestroyJointRadiusPercent = 50
E.BlastRadius = 6
E.BlastPressure = 500000
Player.Health = Player.Health - 100
end

Part.Touched:connect(onTouch)"
Report Abuse
DarkFlameCrimsonXana is not online. DarkFlameCrimsonXana
Joined: 24 May 2012
Total Posts: 47
03 May 2015 07:23 PM
This is the Game:
http://www.roblox.com/item.aspx?id=241860429
Report Abuse
Qorm is not online. Qorm
Joined: 25 Jul 2010
Total Posts: 1650
03 May 2015 07:51 PM
script.Parent.Touched:connect(function(onTouch)
if onTouch.Parent:findFirstChild("Humanoid") then
humanoid=onTouch.Parent.Humanoid
explode=Instance.new("Explosion",humanoid.Parent)
humanoid.Health=humanoid.Health-100
end
end)
Report Abuse
Coolmonkey4eva is not online. Coolmonkey4eva
Joined: 29 Feb 2012
Total Posts: 73
04 May 2015 07:06 PM
I played the game for you. Looks really cool when you die with the smoke effects.
Report Abuse
DarkFlameCrimsonXana is not online. DarkFlameCrimsonXana
Joined: 24 May 2012
Total Posts: 47
05 May 2015 09:25 AM
@ Cool thank you.
It's not done yet I plan on adding DBZ moves when I become a professional Lua scripter.
Report Abuse
Mads898p is not online. Mads898p
Joined: 09 Nov 2013
Total Posts: 41
05 May 2015 09:26 AM
Whut?!
Report Abuse
K7Q is not online. K7Q
Joined: 23 Mar 2013
Total Posts: 5546
05 May 2015 10:43 AM
dont listen to cool he can't script.
do
Instance.new("Explosion", game.Workspace.Part)
Report Abuse
Coolmonkey4eva is not online. Coolmonkey4eva
Joined: 29 Feb 2012
Total Posts: 73
06 May 2015 06:46 PM
@K7Q I am very new to Lua also. That message was just to give him an idea of what to do.
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
06 May 2015 07:16 PM
local radius = 30 -- radius of explosion
local power = 200 -- power of explosion
local timer = 3 -- time to wait before it can blow up again
local debounce = false -- dont touch this one
script.Parent.Touched:connect(funciton()
if not debounce then
debounce = true
local e = Instance.new("Explosion",script.Parent)
e.BlastRadius = radius
e.BlastPressure = power
e.Position = script.Parent.Position
wait(timer)
debounce = false
end
end)



AND THE TIGER GOES ROAR
Report Abuse
DarkFlameCrimsonXana is not online. DarkFlameCrimsonXana
Joined: 24 May 2012
Total Posts: 47
09 May 2015 01:23 PM
I've already made the script and I've stated making a tool.
Report Abuse
Mads898p is not online. Mads898p
Joined: 09 Nov 2013
Total Posts: 41
12 May 2015 09:40 AM
local radius = 30 -- radius of explosion
local power = 200 -- power of explosion
local timer = 3 -- time to wait before it can blow up again
local debounce = false -- dont touch this one
script.Parent.Touched:connect(funciton()
if not debounce then
debounce = true
local e = Instance.new("Explosion",script.Parent)
e.BlastRadius = radius
e.BlastPressure = power
e.Position = script.Parent.Position
wait(timer)
debounce = false
end
end)
Report Abuse
StrangeAzAZ09azaZ is not online. StrangeAzAZ09azaZ
Joined: 25 Jul 2016
Total Posts: 1
23 Oct 2017 09:21 AM
I LIKE DONUTS!
;-;
Report Abuse
K7Q is not online. K7Q
Joined: 23 Mar 2013
Total Posts: 5546
23 Oct 2017 12:37 PM
...?
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
23 Oct 2017 05:52 PM
lol i spelt function wrong

also if you do this you might want to do


script.Parent.Touched:Connect(function(hit)
if (not debounce) and not hit:IsGrounded()
-- rest


but it depends on what else you're going to do, and what hits what


Report Abuse
pearldrop2468 is not online. pearldrop2468
Joined: 29 Jul 2016
Total Posts: 3
12 Nov 2017 05:38 PM
Dark, Thank You for the script, but for some random reason it doesn't really work & keeps giving me errors. E.g; Workspace.Explodes When ################## attempt to index local 'Player' (a nil value) That's what happens & it's very sad & irritating to me that I have to keep changing or fixing errors when on the other hand, you & other people apparently said it worked which confuses me and I just am completely lost. Also, Please do not put the quotation marks as when I copy & paste it says 'String not complete.' Thank you, though and hope you can fix this error for me!
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