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
 

WHY WONT THIS WORK?

Previous Thread :: Next Thread 
skyarex is not online. 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
kingbowler1040 is not online. kingbowler1040
Joined: 03 Oct 2011
Total Posts: 1202
17 Dec 2013 10:25 AM
seems legit
Report Abuse
TheRobloxian909 is not online. TheRobloxian909
Joined: 08 Aug 2013
Total Posts: 2444
17 Dec 2013 10:31 AM
No Scope or key function...
Report Abuse
ForceSky is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. skyarex
Joined: 21 Mar 2010
Total Posts: 12989
20 Dec 2013 07:56 AM
bump

"Don't Panic"- HHGTTG
Report Abuse
velibor is not online. 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
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