SerGregor
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7957 |
|
|
| 22 May 2016 04:09 PM |
local Damager = sword.Touched:connect(function(Hit) if Hit and Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") then
end end)
ive done MANY attempts on doing this correctly, and that's the base of the event so i can just show you what i mean
so i got a sword, and on that specific slash, it should give 40 damage ONCE to each player it hits, then next slash it does the same, etc, etc
like, i seem to have problems scripting the correct debounce for this.. |
|
|
| Report Abuse |
|
|
SerGregor
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7957 |
|
| |
|
Lem0nzzx
|
  |
| Joined: 08 Feb 2016 |
| Total Posts: 1604 |
|
|
| 22 May 2016 04:20 PM |
local deb = false local Damager = sword.Touched:connect(function(Hit) if deb == false then deb = true if Hit and Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") then
end wait(1) deb = false end end)
|
|
|
| Report Abuse |
|
|
SerGregor
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7957 |
|
|
| 22 May 2016 04:21 PM |
| nope can't do that one, because what if the sword hits two person at once? it'll only damage one |
|
|
| Report Abuse |
|
|
Lem0nzzx
|
  |
| Joined: 08 Feb 2016 |
| Total Posts: 1604 |
|
|
| 22 May 2016 04:23 PM |
local deb = false local Damager = sword.Touched:connect(function(Hit) if deb == false then deb = true if Hit and Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") then
end wait(.1) deb = false end end)
|
|
|
| Report Abuse |
|
|
SerGregor
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7957 |
|
|
| 22 May 2016 04:24 PM |
| that's not reliable at all, that's a hope and gamble. |
|
|
| Report Abuse |
|
|
Lem0nzzx
|
  |
| Joined: 08 Feb 2016 |
| Total Posts: 1604 |
|
|
| 22 May 2016 04:30 PM |
local plr = nil local deb = false script.Parent.Touched:connect(function(hit) if deb == false then deb = true if hit.Parent:findFirstChild("Humanoid") and plr ~= hit.Parent.Name then --damage plr = hit.Parent.Name wait(1) plr = nil end wait() end end)
|
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 22 May 2016 04:37 PM |
I'd do it like this.
EDIT: ROBLOX is blocking the code for some stupid reason. Use this Pastebin: pastebin/EWwXn9S2 |
|
|
| Report Abuse |
|
|
SerGregor
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7957 |
|
| |
|
Slydexia
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 98517 |
|
|
| 23 May 2016 12:02 PM |
hitppl = {}
alreadyHit = false
function onhit(hit) alreadyHit = false for a = 1,#hitppl do if hitppl[a] == hit.Parent then alreadyhit = true end if alreadyHit == false then table.insert(hit.Parent) --DO YOUR HITTING HERE end end
and in the swinging part of the code, just have the table reset after each swing like this:
hitppl = {}
then you can hit them with another swing. |
|
|
| Report Abuse |
|
|
SerGregor
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7957 |
|
|
| 23 May 2016 12:11 PM |
| full of errors and i dont think it'll work because i did something like that |
|
|
| Report Abuse |
|
|
Slydexia
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 98517 |
|
|
| 23 May 2016 12:19 PM |
| i forgot a second 'end' after the first check. try that. |
|
|
| Report Abuse |
|
|
ownedyou1
|
  |
| Joined: 03 Jul 2008 |
| Total Posts: 528 |
|
|
| 23 May 2016 12:20 PM |
add this to ur on hit script for the sword then; local damage=420/100 local time=0.5 local deb=false
function on(hit) local hum=hit.Parent:findFirstChild("Humanoid") if deb==false and hum~=nil then
deb=true hum.Health=hum.Health-damage wait(time) deb=false else
end
end
script.Parent.Sword.Touched:connect(on) |
|
|
| Report Abuse |
|
|
Inigo18
|
  |
| Joined: 02 Feb 2014 |
| Total Posts: 1041 |
|
|
| 23 May 2016 12:22 PM |
| ffs, you cannot hit two players at once. ROBLOX is not that slow you know. "dis doesnt work omg" proves you didn't even try it. |
|
|
| Report Abuse |
|
|
SerGregor
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7957 |
|
|
| 23 May 2016 12:24 PM |
@owned nope
@inigo
"gonna be of no help whatsoever and just complain on this guy for no good reason because im in a bad mood" |
|
|
| Report Abuse |
|
|