|
| 19 Jul 2013 12:29 PM |
How do I use instance.new?
Im doing this so far. (It's in a Gui)
function click() b = game.Workspace.Blowup e = b.Instance.new("Explosion") e.BlastRadius = 5 e.BlastPressure = 500000 e.Position = CFrame.new(95, 364.2, -371) end
script.Parent.MouseButton1Click:connect(click)
Does that work or no?
|
|
|
| Report Abuse |
|
|
Vermis
|
  |
| Joined: 02 Jan 2013 |
| Total Posts: 11501 |
|
|
| 19 Jul 2013 12:30 PM |
| e = Instance.new("Explosion",b <--set the parent here) |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 19 Jul 2013 12:31 PM |
Parent the Explosion to Workspace.
e = b.Instance.new("Explosion",Workspace)
Why did you define variable 'b' if you are not going to use it? Position is a Vector3 value, not a CFrame value.
e.Position = CFrame.new(95, 364.2, -371) to e.Position = Vector3.new(95, 364.2, -371) |
|
|
| Report Abuse |
|
|
|
| 19 Jul 2013 12:31 PM |
| Ok, thanks. I didn't know that. |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 19 Jul 2013 12:32 PM |
Lol. I didn't even catch that.
e = b.Instance.new("Explosion",Workspace)
You wrote that line because you wanted to parent the Explosion to b, right? It should be the following:
e = Instance.new("Explosion",b) |
|
|
| Report Abuse |
|
|
|
| 19 Jul 2013 12:35 PM |
So, How come this wont work?
function click() b = game.Workspace.Blowup e = b.Instance.new("Explosion",b) e.BlastRadius = 5 e.BlastPressure = 500000 e.Position = Vector3.new(95, 364.2, -371) end
script.Parent.MouseButton1Click:connect(click)
It makes no explosion at all. |
|
|
| Report Abuse |
|
|
|
| 19 Jul 2013 12:48 PM |
Beginers & Experts get nowhere without putting a print statement every-other line, and reading the output. Is this in a local script? You cannot read the output, unless you EDIT Test>Play Solo....
function click() print("Explode") if it prints nothing, then u r not getting here...... b = game.Workspace.Blowup e = b.Instance.new("Explosion",b) e.BlastRadius = 5 e.BlastPressure = 500000 e.Position = Vector3.new(95, 364.2, -371) end |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 19 Jul 2013 12:54 PM |
Make sure this is all in a LocalScript
mouse = game.Players.LocalPlayer:GetMouse() mouse.Button1Down:connect(function() e = Instance.new("Explosion") e.BlastRadius, e.BlastPressure, e.Position = 5, 500000, Vector3.new(95, 364.2, -371) e.Parent = game.Workspace.Blowup end) |
|
|
| Report Abuse |
|
|