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 |
|
|
|
| 01 Sep 2012 06:49 PM |
| This is the bullet script. We need the shooter script to examine. |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 22 Jun 2010 |
| Total Posts: 2690 |
|
|
| 02 Sep 2012 05:47 PM |
| So it should be in paintball shooter not paintball? |
|
|
| Report Abuse |
|
|