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 » Scripters
Home Search
 

Re: Good scripters please help.

Previous Thread :: Next Thread 
tobyjing2005 is online. tobyjing2005
Joined: 26 Mar 2014
Total Posts: 169
07 Jun 2016 05:34 AM
I have a problem with my gun, it's an Uzi and when I click two times to fire quickly it will just fire from 20 ammo down like this: 20, 18, 16, 14... I need it to do this even when I spam click fire: 20, 19, 18, 16...

Can someone help?



Code:

--Variables
local tool = script.Parent
local weld = Instance.new("ManualWeld",tool)
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local canfire = true
local fireP = tool.FiringPlace
local AmmoGui = plr.PlayerGui.ScreenGui.TextBox
local debounce = true
local AValue = tool.Ammo.Value
debounce = tool.Debounce
--End Of Variables

--Pre Scripts
weld = Instance.new("ManualWeld", tool)
weld.Part0 = tool.Handle
weld.Part1 = tool.FiringPlace
weld.C0 = weld.C0 * CFrame.new(Vector3.new(0,1,0.5))
AmmoGui.Visible = false
AValue = 20
AmmoGui.Text = AValue .. "/20"
script.Parent.Handle.CFrame = script.Parent.Handle.CFrame * CFrame.fromAxisAngle(Vector3.new(2,0,0).unit, 0.5)
--End Of Pre Scripts

--Gun Script
tool.Equipped:connect(function(mouse2)
AmmoGui.Visible = true
mouse.Button1Down:connect(function() --Firing
if canfire == true then
debounce = true
repeat
fire = Instance.new("Fire",tool.FiringPlace)
fire.Size = 0.5
plr.Character.Torso["Right Shoulder"].C0 = plr.Character.Torso["Right Shoulder"].C0 * CFrame.fromAxisAngle(Vector3.new(0,0,1).unit, 0.2)
wait(0.05)
plr.Character.Torso["Right Shoulder"].C0 = plr.Character.Torso["Right Shoulder"].C0 * CFrame.fromAxisAngle(Vector3.new(0,0,-1).unit, 0.2)
tool.Fire:Play()
local ray = Ray.new(tool.FiringPlace.CFrame.p, (mouse2.Hit.p - tool.FiringPlace.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)

local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("Pastel brown")
beam.CanCollide = false
beam.Anchored = true
beam.FormFactor = "Custom"
beam.Material = "Neon"
beam.Locked = true

local distance = (tool.FiringPlace.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.1,0.1,distance)
beam.CFrame = CFrame.new(tool.FiringPlace.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

game:GetService("Debris"):AddItem(beam, 0.05)

if part then
local humanoid = part.Parent:FindFirstChild("Humanoid")

if not humanoid then
humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
end

if humanoid then
humanoid.Health = humanoid.Health - 18
end
end

mouse.KeyDown:connect(function(key)
if key == "r" and AValue <= 19 then
reload()
end
end)

AValue = AValue - 1
AmmoGui.Text = AValue .. "/20"
if AValue <= 0 then
reload()
end
wait(0.05)
fire:Destroy()
until debounce == false or canfire == false
end
end)
end)

tool.Unequipped:connect(function()
AmmoGui.Visible = false
end)

mouse.Button1Up:connect(function() --Button1Up
debounce = false
end)

function reload()
if AmmoGui.Text ~= "Reloading..." then
fire:Destroy()
canfire = false
AmmoGui.Text = "Reloading..."
tool.Reload:Play()
plr.Character.Torso["Right Shoulder"].C0 = plr.Character.Torso["Right Shoulder"].C0 * CFrame.fromAxisAngle(Vector3.new(0,0,1).unit, 0.2)
f = Instance.new("Part", workspace)
f.Size = Vector3.new(0.1,0.5,2)
f.CFrame = tool.Handle.CFrame * CFrame.new(0,0,-1.2)
wait(1.6)
plr.Character.Torso["Right Shoulder"].C0 = plr.Character.Torso["Right Shoulder"].C0 * CFrame.fromAxisAngle(Vector3.new(0,0,-1).unit, 0.2)
f:Destroy()
AValue = 20
AmmoGui.Text = AValue .. "/20"
canfire = true
end
end
--End Of Gun Script


Kabab
Report Abuse
AlertedDynamite is not online. AlertedDynamite
Joined: 12 Jun 2015
Total Posts: 667
07 Jun 2016 05:37 AM
Wheres the shooting part of this script
Report Abuse
GodfatherChris is not online. GodfatherChris
Joined: 15 Sep 2008
Total Posts: 623
07 Jun 2016 05:45 AM
Thompson 1928, Colt 1911, and Remy 870 in high quality with textures
Report Abuse
tobyjing2005 is online. tobyjing2005
Joined: 26 Mar 2014
Total Posts: 169
07 Jun 2016 05:47 AM
There is a shooting part, it's one script in the gun, creates a beam.


Kabab
Report Abuse
GodfatherChris is not online. GodfatherChris
Joined: 15 Sep 2008
Total Posts: 623
07 Jun 2016 05:50 AM
a shame that MIKED quit ROBLOX
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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