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
 

Help with Instance.new()

Previous Thread :: Next Thread 
froylin3 is not online. froylin3
Joined: 11 Aug 2010
Total Posts: 1672
26 Nov 2012 10:40 PM
I am new to scripting and I am trying to edit the scripts in a Jet that I made. I used scripts from another jet for the purpose of the test. I want to make my Jet shoot smoke out the back when you press P. I put:

if (key=="p") then
Instance.new(Smoke, Workspace.Dragon.NewTrain.Plane.Parts.Jet)
end

I wasn't sure if the instance.new would know where to put the smoke since I had such a long thing saying Workspace.Dragon..... Etc.

Is the problem the Instance.New, or is it somthing else? Please help me!

Thanks :)
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
26 Nov 2012 10:41 PM
You need quotations around the class name.
Instance.new("Smoke", location)
Report Abuse
froylin3 is not online. froylin3
Joined: 11 Aug 2010
Total Posts: 1672
26 Nov 2012 11:01 PM
Ohhhhh Thanks! I totally fogot about that!
Report Abuse
froylin3 is not online. froylin3
Joined: 11 Aug 2010
Total Posts: 1672
26 Nov 2012 11:04 PM
Hmm, still isn't working. I will try to debug it.
Report Abuse
GhostSailor is not online. GhostSailor
Joined: 02 Jul 2010
Total Posts: 1913
27 Nov 2012 12:01 AM
While you do that, you may want to consider this.
With that code, every time you pressed p, it would make more smoke, and that smoke is never removed. If I were to press p rapidly, it would lag the game a lot.

-~Obly of C&G~-
Report Abuse
dradra44 is not online. dradra44
Joined: 11 Jul 2008
Total Posts: 1040
27 Nov 2012 12:04 AM
Ghost is right. I would suggest adding a local boolean, like this:



b = false

if (key=="p") then
if b == false then
Instance.new("Smoke").Parent = Workspace.Dragon.NewTrain.Plane.Parts.Jet
b = true
end
end


Or, maybe waiting a set amount of time, then removing the smoke?

if (key=="p") then
smke = Instance.new("Smoke")
smke.Parent = game.Workspace.Dragon.NewTrain.Plane.Parts.Jet
wait(5) --Set the amount here
smke:Destroy()
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