skyarex
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 12989 |
|
|
| 17 Dec 2013 10:10 AM |
CurAmmo = script.Parent.CurAmmo.Value MagAmount = script.Parent.MagAmount.Value Hit1 = math.random(50,115) Hit2 = math.random(50,90) Hit3 = math.random(50,65) RawDmg = (Hit1 + Hit2 + Hit3)/3 HitDmg = math.celi(RawDmg) TotalAmmo = CurAmmo * MagAmount
bulletFired = false
Range = 5
function AMMO() if TotalAmmo > 0 then Bullet() wait(Range) bullet:Destroy() else return end end
function Bullet() bullet = Instance.new("Part",game:GetService("Workspace")) bullet.Shape = "Ball" bullet.Name = "Bullet" bullet.Size = Vector3.new(.5,.5,.5) bullet.Position = script.Parent.Muzzle.Position bullet.BodyForce.force = Vector3.new(100,0,0) bulletFired = true if bulletFired == true then Struck() wait(Range) bullet:Destroy() else bullet:Destroy() end end
function Struck() bullet.Touched:connect(function(hit) if hit.Parent:findFirstChild("ForceField") ~= nil then bullet:Destroy() bulletFired = false elseif hit.Parent:FindFirstChild("Humanoid") then hit.Parent.findFirstChild("Humanoid"):TakeDamage(HitDmg) bullet:Destroy() bulletFired = false else return end end
script.Parent.Button1Down:connect(AMMO)
script.Parent.Button2Down:connect(Scope)
script.Parent.KeyDown:connect(key)
"Don't Panic"- HHGTTG |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Dec 2013 10:31 AM |
| No Scope or key function... |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 17 Dec 2013 10:32 AM |
| So Script.Parent is mouse? Look at connections. |
|
|
| Report Abuse |
|
|
skyarex
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 12989 |
|
|
| 17 Dec 2013 11:35 AM |
@force
script.Parent is the tool.
"Don't Panic"- HHGTTG |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 19 Dec 2013 08:08 PM |
script.Parent.Button1Down
Tool's can't do Button1Down. |
|
|
| Report Abuse |
|
|
skyarex
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 12989 |
|
|
| 20 Dec 2013 07:13 AM |
@force
Then how would you do it? What do you do for tools?
"Don't Panic"- HHGTTG |
|
|
| Report Abuse |
|
|
skyarex
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 12989 |
|
| |
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 20 Dec 2013 08:12 AM |
script.Parent.Equipped:connect(function(mouse) mouse.KeyDown:connect(function(Key) if key == "r" then Reload() end end) mouse.Button1Down:connect(function() Shoot() end) end)
There you go :) |
|
|
| Report Abuse |
|
|