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: Can't find the problem after 3hours.

Previous Thread :: Next Thread 
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
12 Jul 2017 08:16 PM
the target name is SB and allbuildings is


allbuildings = game.Workspace:WaitForChild(player.Name.."Builds"):GetChildren()



mouse.Move:connect(function()
target = mouse.Target
local character = player.Character
magnitude = (character.Torso.Position - target.Position).magnitude
if magnitude < 20 then
activezone = true
else
activezone = false
end
print ("debug")
print (target.Name)
print (target.Parent.Parent)
if target.Name == "SB" and target.Parent.Parent == allbuildings then
print("1")
for _,v in pairs(allbuildings) do--makes only target color change
print("2")
if target == v.SB then
print("3")
target.SelectionBox.Color = BrickColor.new("Fog")
else
print("4")
v.SelectionBox.Color = BrickColor.new("Storm blue")
end
end

end
end)


OUTPUT:
debug
SB
DeGamesBuilds


I have no idea.



Report Abuse
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
12 Jul 2017 08:17 PM
issue is it won't print 1 2 3 and 4


Report Abuse
cooltintin543 is not online. cooltintin543
Joined: 13 Nov 2012
Total Posts: 67
12 Jul 2017 08:20 PM
try adding a

print(allbuildings==target.Parent.Parent)

if its false then compare by name
Report Abuse
booing is not online. booing
Joined: 04 May 2009
Total Posts: 6594
12 Jul 2017 08:25 PM
You define allbuidings as:

allbuildings = game.Workspace:WaitForChild(player.Name.."Builds"):GetChildren()

Which is a table.

Set it as

allbuildings = game.Workspace:WaitForChild(player.Name.."Builds")

Then iterate through

allbuildings:GetChildren()
Report Abuse
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
12 Jul 2017 08:54 PM
Ohh that helped alot. Didn't know you could print things like that. Thanks!!!


Report Abuse
cooltintin543 is not online. cooltintin543
Joined: 13 Nov 2012
Total Posts: 67
12 Jul 2017 08:57 PM
cant tell if you're being sarcastic or not
Report Abuse
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
12 Jul 2017 09:09 PM
I'm serious. I didn't know you could print target.Parent.Parent == allbuildings and get a boolean.


Report Abuse
DeGames is online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
12 Jul 2017 09:09 PM
i also feel stupid for overlooking the :GetChildren() part


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