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 » Scripting Helpers
Home Search
 

Re: Instance.new

Previous Thread :: Next Thread 
LbpPlayer34 is not online. LbpPlayer34
Joined: 08 Jul 2012
Total Posts: 523
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 is not online. 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 is not online. 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
LbpPlayer34 is not online. LbpPlayer34
Joined: 08 Jul 2012
Total Posts: 523
19 Jul 2013 12:31 PM
Ok, thanks. I didn't know that.
Report Abuse
grimm343 is not online. 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
LbpPlayer34 is not online. LbpPlayer34
Joined: 08 Jul 2012
Total Posts: 523
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
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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