|
| 25 Oct 2015 08:50 PM |
Hi. It’s been forever since I’ve been on this branch of the forum. I missed it. I’m also a bit rusty with my programming, so bear with me.
Anyways...
I have programmed this script (LocalScript) so that when the player uses it, it produces an explosion, that ultimately kills them, and any other characters surrounding them.
But the problem is, I want the user to survive, so it is more for the “Surprise” tactic. But, I cannot find a way to simultaneously create a ForceField object that allows the player to survive the explosion.
If you can help, I thank you, but any support would be nice.
Anyways, It’s nice to be back.
Here is the script:
bin = script.Parent
--here it is
function onButton1Down(mouse)
local player = game.Players.LocalPlayer if player == nil then return end local EP = Instance.new("Explosion", player.Character.Torso) local FF = Instance.new("ForceField", player.Character.Torso) EP.Position = player.Character.Torso.Position wait() player.Character.Humanoid.MaxHealth = 100 player.Character.Humanoid.Health = 100 wait(3) FF = nil mouse.Icon = "rbxasset://textures\\ArrowCursor.png" print[[Yeah, it is working.]]
end
function onSelected(mouse) mouse.Icon = "rbxasset://textures\\ArrowCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end
bin.Selected:connect(onSelected) |
|
|
| Report Abuse |
|
|
| |
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 25 Oct 2015 09:15 PM |
Here is an example:
local f = Instance.new("Forcefield") --New forcefield. f.Parent = player.Torso --Parents the forcefield. wait (.1) --Wait just to be sure the ff loads. local e = Instance.new("Explosion")--New explosion. e.Parent = game.Workspace --Parent the explosion. e.Position = player.Torso.Position -- Remember, explosions have a position property that you must manually change.
See if you can figure it out now.
u sicko! |
|
|
| Report Abuse |
|
|
|
| 25 Oct 2015 09:17 PM |
Bro.
Thank you.
Father is Happy.
But he is still standing behind me.
HELP. |
|
|
| Report Abuse |
|
|
|
| 25 Oct 2015 09:18 PM |
wait if forcefield is parented inside of torso...
OHMYGOD.
I FIGURED IT OUT.
THANK YOU. |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 25 Oct 2015 09:18 PM |
local p = game.Players.LocalPlayer
function onButton1Down(mouse) local e = Instance.new('Explosion') e.DestroyJointRadiusPercent = 0 e.Hit:connect(function(obj) if obj.Parent:FindFirstChild'Humanoid' and obj.Parent ~= p.Character then obj.Parent.Humanoid.Health = 0 end end) if p.Character:FindFirstChild'Torso' then e.Parent = p.Character.Torso end mouse.Icon = "rbxasset://textures\\ArrowCursor.png" end |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 25 Oct 2015 09:18 PM |
For starters, is this in a hopperbin?
u sicko! |
|
|
| Report Abuse |
|
|
|
| 25 Oct 2015 09:22 PM |
| Yes. I favor them over “Tools” I grew up with them, and I still use them. |
|
|
| Report Abuse |
|
|
| |
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 25 Oct 2015 09:24 PM |
Ok, for starters read this: wiki.roblox.com/index.php?title=HopperBin
Note the first paragraph.
u sicko! |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 25 Oct 2015 09:24 PM |
Oh nevermind. You should still use tools instead.
u sicko! |
|
|
| Report Abuse |
|
|
|
| 25 Oct 2015 09:27 PM |
eh
don’t matter for me.
I just need to fix this forcefield.
Anyways thanks |
|
|
| Report Abuse |
|
|