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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Sniper Rifle

Previous Thread :: Next Thread 
bovine123 is not online. bovine123
Joined: 22 Jun 2010
Total Posts: 2690
01 Sep 2012 06:40 PM
Hi,

I have a sniper rifle at my game, and it works great, except for one thing, which is that you can constantly click and spam the sniper. I need to add a wait(2) somewhere in the script, but I don't know where. If someone could help me that would be greatly appreciated. Here is the code:


ball = script.Parent
damage = 70


function onTouched(hit)
if hit.Name ~= "ZoomB" then
local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then
tagHumanoid(humanoid)
humanoid.Health = humanoid.Health - damage
ball:Destroy()
wait(2)
untagHumanoid(humanoid)
end
end

wait(3)
connection:disconnect()
ball.Parent = nil
end

function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = ball:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end


function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end

connection = ball.Touched:connect(onTouched)

wait(0.65)
ball.Parent = nil
Report Abuse
StealthKing95 is online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
01 Sep 2012 06:49 PM
This is the bullet script. We need the shooter script to examine.
Report Abuse
tahu157 is not online. tahu157
Joined: 16 Nov 2008
Total Posts: 15045
01 Sep 2012 07:28 PM
Like the guy in front of me said, this is the script that creates the bullet and tells it to do damage. However, I may be able to help you without seeing the script.

First off somewhere at the top of the script put: ReloadTime = 2


All you really have to do is put this line of code:


wait (ReloadTime)


Inside the firing function and after the part that actually makes it fire.



--
これは私の署名である、それは日本語である
Report Abuse
bovine123 is not online. bovine123
Joined: 22 Jun 2010
Total Posts: 2690
02 Sep 2012 05:47 PM
So it should be in paintball shooter not paintball?
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