|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 03 May 2015 07:23 PM |
This is the Game: http://www.roblox.com/item.aspx?id=241860429 |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 04 May 2015 07:06 PM |
| I played the game for you. Looks really cool when you die with the smoke effects. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 09 Nov 2013 |
| Total Posts: 41 |
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 09 May 2015 01:23 PM |
| I've already made the script and I've stated making a tool. |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
K7Q
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 5546 |
|
| |
|
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 |
|
|
|
| 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 |
|
|