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
 

Pistol Shoots only one mag then doesnt shoot anymore, Help?

Previous Thread :: Next Thread 
Vicctus is not online. Vicctus
Joined: 05 Sep 2013
Total Posts: 589
09 Jun 2014 04:03 PM
-- general stats --
_G.GunName="Officer's Pistol"
_G.GunDesc=""
_G.Tool=script.Parent
_G.Teamkill = true
_G.Handle=script.Parent["Handle"]
_G.SoundBase=0.9 _G.SoundDivider=1.7
_G.Flash = script.Parent:FindFirstChild("Barrel")
_G.WeldRightArm=CFrame.new(-1,.4,0.4)*CFrame.Angles(math.rad(270),math.rad(-5),0)
_G.WeldLeftArm=CFrame.new(0.8,0.5,0.4)*CFrame.Angles(math.rad(280),math.rad(40),0)
_G.Stats={
["maxaccuracy"]=0.06;
["minaccuracy"]=0.02;
["animationtype"]="Pistol";
["firerate"]=0.1;
["aimflaw"]=2;
["reposition"]=33;
["focuscamera"]=60;
["firepos"]=Vector3.new(0,0.55,-1.3);
["firemode"]="Semi";
["reloading"]=false;
}
_G.Origin=script.Parent
_G.Values={
["canfire"]=script.CanFire;
["ammo"]=script.Ammo;
["ammomax"]=script.AmmoMax;
["recoil"]=script.Recoil;
}

_G.DMG=(function(range) damage=12 return damage end)


-- parts --
_G.bullet=Instance.new("Part")
_G.bullet.Anchored=true
_G.bullet.CanCollide=false
_G.bullet.formFactor="Custom"
_G.bullet.Name = "Bullet"
_G.bullet.Size=Vector3.new(1,1,1)
_G.bullet.BrickColor=BrickColor.new("Bright yellow")
_G.bullet.Reflectance=0.01
mesh=Instance.new("BlockMesh", _G.bullet)
mesh.Scale=Vector3.new(0.1,0.1,1)
_G.rayDisp1=0.03
_G.rayDisp2=0.08

_G.impact=Instance.new("Part")
_G.impact.Anchored=true
_G.impact.Transparency=0.1
_G.impact.CanCollide=false
_G.impact.formFactor="Custom"
_G.impact.Size=Vector3.new(0.1,0.1,0.1)
fire=Instance.new("Fire", _G.impact)
fire.Color=Color3.new(0, 0, 256-153)
fire.SecondaryColor=Color3.new(1, 0, 0)
fire.Enabled=true
fire.Heat=1
fire.Size=2
_G.impDisp=0.05

_G.hole=Instance.new("Part")
_G.hole.Anchored=true
_G.hole.CanCollide=false
_G.hole.formFactor="Custom"
_G.hole.Size=Vector3.new(.2,.2,.2)
_G.hole.BrickColor=BrickColor.new("Black")
_G.holeDisp=3

-- if game.Players.LocalPlayer.Name == "GustFlame" then
-- script.Parent.Handle.Fire.SoundId = "http://www.roblox.com/asset/?id=130833677"
-- script.Parent.Handle.Fire.Pitch = 1
-- end
-- done --
_G.GunStatsLoaded=true
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
09 Jun 2014 04:05 PM
Your code..
Is..
Painful
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
09 Jun 2014 04:06 PM
Be carfull, your but might get hurt by how many _G Strings you have.

Get it..No? Okay..
Report Abuse
Vicctus is not online. Vicctus
Joined: 05 Sep 2013
Total Posts: 589
09 Jun 2014 04:09 PM
Didn't get it.
Report Abuse
Vicctus is not online. Vicctus
Joined: 05 Sep 2013
Total Posts: 589
09 Jun 2014 04:12 PM
B1.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
09 Jun 2014 04:14 PM
You have a lot of global variables, and a variable can be
_G.String="lol"
Report Abuse
ZeroSpectrum is not online. ZeroSpectrum
Joined: 02 Mar 2011
Total Posts: 315
09 Jun 2014 04:14 PM
Where is the reload function? As a matter of fact, where is the firing function? All I see is a bunch of global variables.
Report Abuse
Firewarrior321 is not online. Firewarrior321
Joined: 09 Dec 2011
Total Posts: 3443
09 Jun 2014 04:16 PM
@LordMatthew:

I usually think of script-ers as cold, forbearing, and decisive.
But apparently scripting does not irritate one to the point of losing their sense of humor.
Lol.

Anyway, I do agree the coding is rather...messy.
I do not see a reload mechanic.

You could either use a KeyBinding function or make reloading automatic.

Automatic:

(enabled = true)

if Ammo < 1 and enabled == true then
enabled = false
ReL = Instance.new("Sound", script.Parent)
ReL.SoundId = "[Insert sound ID here]"
ReL.Volume = 1
ReL.Pitch = 1
ReL:Play()
game.Debris:AddItem(ReL, 1)
wait([However long it takes the reload sound to play])
ReL:Destroy()
Ammo = MaxAmmo
enabled = true
end

Sorry, I had to post this and leave before writing down the KeyBinding function.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
09 Jun 2014 04:19 PM
Only group scripters are cold and heartless, Most scripters actully turn into more like noobs than anything, for example,
A person without scripting knowledge:
Hello, how has your day been?
Scripting knowledge:
yo watz up
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