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
 

Making the regular rocket launcher with "ammo"

Previous Thread :: Next Thread 
theMetasponge64 is not online. theMetasponge64
Joined: 12 Feb 2010
Total Posts: 18284
14 Jan 2013 08:35 PM
I want to modify the original roblox rocket launcher by making it have to reload. Similar to the six shooter, after 6 shots, it would point a direction (Maybe down or sideways) and have to wait a few seconds before another 6 shots could be fired. I attemped to copy this line of code and failed: (What can i say, i'm a noobie to scripting)

reloading = reloading + 1
if reloading >= 6 then
if reloadSound ~= nil then
reloadSound:Play()
end
reloading = 0
Tool.GripUp = Vector3.new(0,-0.5,1)
wait(0.5)
Tool.GripUp = Vector3.new(0,0,1)
end

wait(reload)
gunOut()
wait(reload)

enabled = true

end

I would be happy to know how this works because i'm trying to make my game as authentic as possible.
Report Abuse
harryx is not online. harryx
Joined: 25 Oct 2008
Total Posts: 3209
15 Jan 2013 06:14 AM
I'll try to go through it in chunks.

reloading = reloading + 1
if reloading >= 6 then

Each time the gun fires, the first line adds 1 to the value 'reloading', as to keep count of when it should reload. In the next line it checks if the value has reached six, and then if it does, continues on to the next section.

if reloadSound ~= nil then
reloadSound:Play()
end

This chunk is for playing the reloading sound. It first makes sure that the sound exists, then plays it.

reloading = 0
Tool.GripUp = Vector3.new(0,-0.5,1)
wait(0.5)
Tool.GripUp = Vector3.new(0,0,1)
end

Firstly, it resets the value of 'reloading'. Then it changes the position of the tool so it looks as if it is reloading, waits half a second and then returns to its original position.

wait(reload)
gunOut()
wait(reload)

I would have to see the rest of the script to give you a detailed explanation, but it looks like it waits an allotted time, calls the function gunOut() and then waits some more.

enabled = true
end

It changes the value of 'enabled' to true and closes the if statement we had at the start.

Hope this helped you.
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