Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
|
| 12 Aug 2014 09:56 PM |
Hitspots is a table with about 62 CFrame's in it. JustHit is an empty table that has the Players that are hit added to it to avoid double hit. When I used the TouchingPart function, it always returns false and I don't know why.
function TouchingPart(A,B) for i, v2 in pairs(B:GetChildren()) do if v2:IsA("Part") then if ((A.p)-(v2.Position)).magnitude <= 5 then print("true") return true end end end print("false") return false end
for i = 1 , #Hitspots do for i, v in pairs(game.Workspace:GetChildren()) do print(v) if v:IsA("Model") and v:findFirstChild("Humanoid") and v:findFirstChild("Torso") and v:findFirstChild("Head") and v:findFirstChild("ForceField") == nil then if TouchingPart(Hitspots[i],v) == true and v:findFirstChild("Humanoid").Health >= 0 then for i = 1, #JustHit do if JustHit[i] == v then return end end table.insert(JustHit,v) v:findFirstChild("Humanoid"):TakeDamage(10) print("Hit: "..v.Name) end end end end |
|
|
| Report Abuse |
|
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
| |
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
| |
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
| |
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
| |
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
| |
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
| |
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
| |
|
L0cky2013
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 1446 |
|
|
| 12 Aug 2014 11:23 PM |
| If you are using ugly tables to prevent double touches, might as well use a touch event. |
|
|
| Report Abuse |
|
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
|
| 12 Aug 2014 11:26 PM |
No. Just no. If you read what I actually posted you'd know I'm using magnitude to find nearby people to deal damage to.
And wtf do you mean by "ugly tables"?
Also try helping next time. |
|
|
| Report Abuse |
|
|
L0cky2013
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 1446 |
|
| |
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
|
| 13 Aug 2014 06:11 PM |
Bump
Someone helpful, help, please. |
|
|
| Report Abuse |
|
|
Nagrath99
|
  |
| Joined: 26 Mar 2011 |
| Total Posts: 1537 |
|
|
| 13 Aug 2014 06:22 PM |
nvm fixed it Hitspots[i] wasn't recognized after the next for i so I set b = Hitspots[i] before doing it, now it works
|
|
|
| Report Abuse |
|
|