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 » Scripters
Home Search
 

Re: How to spawn something in a Player's torso

Previous Thread :: Next Thread 
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 05:53 PM
I making a GUI button that spawns an explosion in the players torso, but it doesn't work because I can't get the players torso.
Can anyone help?

Here's the script.

function onclick()
local pos = (This is so the position of the bomb is that of the torso, but I cant get the torso)
local bomb = Instance.new("Explosion", ???)
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
bomb.Position = pos

end
script.Parent.MouseButton1Click:connect(onclick)
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 05:55 PM
player's Character's torso

should be indented
script.Parent.MouseButton1Click:connect(function(player)
player.CharacterAdded:wait()
local pos = (This is so the position of the bomb is that of the torso, but I cant get the torso)
local bomb = Instance.new("Explosion", player.Character:WaitForChild('Torso'))
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
bomb.Position = pos
end)
Report Abuse
Stormify is not online. Stormify
Joined: 27 Jan 2012
Total Posts: 378
21 Feb 2015 05:59 PM
this is a revamped better one

script.Parent.MouseButton1Click:connect(function(playerwhoclicked)
bomb = Instance.new("Explosion")
bomb.Parent = playerwhoclicked.Character.Torso
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
end)

don't know if it will work but there it is


mk
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 05:59 PM
I tried that, it gives me the error 'attempt to index local 'player' (a nil value)'
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:01 PM
Storm that won't work you have to set the position of an explosion.
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:01 PM
Holy crap I'm insane

I thought it was a click detector and used the gui event stil lol

1 sec
Report Abuse
Stormify is not online. Stormify
Joined: 27 Jan 2012
Total Posts: 378
21 Feb 2015 06:02 PM
oh alright i didn't check


mk
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:02 PM
Same error for yours stormily, except it's attempt to index local 'playerwhoclicked' a nil value
Report Abuse
Stormify is not online. Stormify
Joined: 27 Jan 2012
Total Posts: 378
21 Feb 2015 06:04 PM
script.Parent.MouseButton1Click:connect(function(playerwhoclicked)
bomb = Instance.new("Explosion")
pos = playerwhoclicked.Character.Torso.CFrame
bomb.Parent = playerwhoclicked.Character.Torso
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
bomb.Position = pos

end)



mk
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:05 PM
Still gives me that error
Report Abuse
devCure is not online. devCure
Joined: 30 Jun 2012
Total Posts: 125
21 Feb 2015 06:05 PM
this
is
confusing
af
Report Abuse
devCure is not online. devCure
Joined: 30 Jun 2012
Total Posts: 125
21 Feb 2015 06:06 PM
this in a localscript or normal script?
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:06 PM
-- LocalScript in the GUI:

local player = game.Players.LocalPlayer
local element = script.Parent
local torso = player.Character:WaitForChild('Torso')

local debounce = true
element.MouseButton1Click:connect(function()
if not debounce then return end
debounce = false
game.ReplicatedStorage.RemoteEvents:FireServer(torso)
debounce = true
end)


-- Script in ServerScriptService.

local explode = Instance.new("RemoteEvent")
explode.Name = "Explode"
explode.Parent = game.ReplicatedStorage.RemoteEvents --make a folder for it.
explode.OnServerEvent:connect(function(player, part)
local bomb = Instance.new("Explosion", workspace)
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
bomb.Position = part.Position
end)

didn't test of course
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:06 PM
Normal right now, I tried both in a Local one and it didn't work.
Report Abuse
ChoongJae is not online. ChoongJae
Joined: 10 Oct 2009
Total Posts: 670
21 Feb 2015 06:08 PM
put this in a localscript under the button

local plr=game.Players.LocalPlayer

function onclick()
if plr.Character and plr.Character.Torso then
local pos = plr.Character.Torso.Position
local bomb = Instance.new("Explosion", ???)
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
bomb.Position = Vector3.new(pos)
end
end

script.Parent.MouseButton1Click:connect(onclick)
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:08 PM
my code > all&&&
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:11 PM
Neither of the new ones work. Chiefs gives me an error message, and Choong's doesn't do anything
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:12 PM
what's the error lol
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:13 PM
RemoteEvents is not a valid member of ReplicatedStorage
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:14 PM
*facedesk*

im going to let you read the code.
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:15 PM
Wait, wait wait hold up
Choong's works, but it was written wrong

This was the original

local plr=game.Players.LocalPlayer

function onclick()

local pos = plr.Character.Torso.Position
local bomb = Instance.new("Explosion", workspace)
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
bomb.Position = ------>Vector3.new(pos) <----
end


script.Parent.MouseButton1Click:connect(onclick)

I changed it to
local plr=game.Players.LocalPlayer

function onclick()

local pos = plr.Character.Torso.Position
local bomb = Instance.new("Explosion", workspace)
bomb.BlastPressure = 1500000
bomb.BlastRadius = 10
bomb.Position = ---->pos<-----
end


script.Parent.MouseButton1Click:connect(onclick)

And it works
cuz when there is a variable, you don't need to use Vector3.new
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:17 PM
Trust me, you want to use my code.

You have to put a RemoteEvents folder in ReplicatedStorage of course.
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:18 PM
The one I'm using works perfectly fine, I don't see the need to change it.
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
21 Feb 2015 06:18 PM
"The one I'm using works perfectly fine, I don't see the need to change it."

that's because you have absolutely no clue what you're doing
Report Abuse
SurKipper is not online. SurKipper
Joined: 25 Dec 2011
Total Posts: 435
21 Feb 2015 06:20 PM
Dude, it works I tried it like 10 times. Just calm down.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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