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 » Scripters
Home Search
 

Re: Why does this always return true?

Previous Thread :: Next Thread 
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
24 May 2016 12:19 PM
functions.isPlaceable = function(turret)
local TrrtSiz = turret:GetModelSize()
local position = turret.PrimaryPart.Position
local r3 = Region3.new(position-TrrtSiz/2,position+TrrtSiz/2)
local parts = game.Workspace:FindPartsInRegion3(r3,nil)
local canbuild = true

for chck = 1, #parts do

if string.sub(parts[chck].Parent.Parent.Name:lower(),1,6) ~= "turret" then
print(parts[chck].Name,parts[chck].Parent.Name,parts[chck].Parent.Parent.Name)
canbuild = false
end
if canbuild then
canbuild = false
local MapR3 = Region3.new(position-(functions.returnMap():GetModelSize()/2),position+(functions.returnMap():GetModelSize()/2))
print(MapR3.Size)
for i,v in ipairs(game.Workspace:FindPartsInRegion3WithIgnoreList(MapR3,{functions.returnMap().Turrets,functions.returnMap().CameraPart},20000)) do
print(v.Name)
if string.sub(v.Parent.Parent.Name:lower(),1,6) == 'turret' then
canbuild = true
end
end
return canbuild
end
end
end
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
24 May 2016 12:22 PM
proof they're not together

http://prntscr.com/b7xk8s
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
24 May 2016 12:25 PM
Add this

else return false

nothing happens if canbuild is false.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
24 May 2016 12:29 PM
returns true regardless. It's printing that the parts inside the turret are within the region3.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
24 May 2016 12:33 PM
updated the script to print out everything that gets run through the last for loop

"Found inside the Map Region3: BPart Descendant of turretTop"

So it's detecting parts of the model to be inside the model.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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