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
 

Re: Returning "false" Instead of "true"

Previous Thread :: Next Thread 
Nagrath99 is not online. 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 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
12 Aug 2014 10:20 PM
z
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
12 Aug 2014 10:37 PM
zz
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
12 Aug 2014 10:55 PM
zzz
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
12 Aug 2014 11:03 PM
zzzz
Report Abuse
ked2000 is not online. ked2000
Joined: 10 Jul 2011
Total Posts: 1059
12 Aug 2014 11:04 PM
zzzzz
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
12 Aug 2014 11:09 PM
zzzzzz
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
12 Aug 2014 11:18 PM
zzzzzzz
Report Abuse
L0cky2013 is not online. 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 is not online. 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 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
12 Aug 2014 11:39 PM
Learn to script, skid
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
13 Aug 2014 06:11 PM
Bump

Someone helpful, help, please.
Report Abuse
Nagrath99 is not online. 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
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