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: Magnitude. My worst enemy..

Previous Thread :: Next Thread 
iGotRekt is not online. iGotRekt
Joined: 23 Jan 2014
Total Posts: 831
29 Jan 2015 01:30 AM
local door = script.Parent.AutoDoor
local doorleft = door.DoorLeft:GetChildren()
local doorright = door.DoorRight:GetChildren()
local enabled = true

while true do
     for i, v in pairs(game.Players:GetChildren()) do

          print('Game located children')

          if (v.Character.Torso.Position - door.Position).magnitude <= 15 and enabled then
               enabled = false
               for i = 0, 5, 0.05 do
                    doorleft.Position = Vector3.new(doorleft.Position.x -5, doorleft.Position.y, doorleft.Position.z)
                    doorright.Position = Vector3.new(doorright.Position.x +5, doorright.Position.y, doorright.Position.z)
                    wait(0.1)
               end

          print('Doors have opened')

          end

          if (v.Character.Torso.Position - door.Position).magnitude > 15 and enabled then
               doorleft.Position = Vector3.new(doorleft.Position.x +5, doorleft.Position.y, doorleft.Position.z)
               doorright.Position = Vector3.new(doorright.Position.x -5, doorright.Position.y, doorright.Position.z)
          end

          print('Doors have closed')

     end

     print('Operation is a success! Congratulations!')

     wait(1)
     enabled = true
     wait()
end

--[[ // Don't mind the prints, they're just checks to see how far the script runs before encountering an error.
My door has multiple bricks, so I am trying to select groups of them at the same time and move each group a certain amount of studs at the same time. I'm not very familiar with the 'GetChildren()' command, so that might be the problem here. Thank you for the help, anyway. // --]]

✗ вυяиσυт699 » ɪGᴏᴛRᴇᴋᴛ

✗ вυяиσυт699 » ɪGᴏᴛRᴇᴋᴛ
Report Abuse
iGotRekt is not online. iGotRekt
Joined: 23 Jan 2014
Total Posts: 831
29 Jan 2015 01:31 AM
I just want to add that whenever I run the script, it skips right down to the last print, where it says "print('Operation is a success! Congratulations!')

✗ вυяиσυт699 » ɪGᴏᴛRᴇᴋᴛ
Report Abuse
iGotRekt is not online. iGotRekt
Joined: 23 Jan 2014
Total Posts: 831
29 Jan 2015 04:57 PM
b1
Report Abuse
iGotRekt is not online. iGotRekt
Joined: 23 Jan 2014
Total Posts: 831
29 Jan 2015 08:52 PM
b2

✗ вυяиσυт699 » ɪGᴏᴛRᴇᴋᴛ
Report Abuse
iwishforpie1 is online. iwishforpie1
Joined: 20 Mar 2011
Total Posts: 1423
29 Jan 2015 09:14 PM
What's the output say?
Report Abuse
iGotRekt is not online. iGotRekt
Joined: 23 Jan 2014
Total Posts: 831
29 Jan 2015 09:35 PM
Operation is a success! Congratulations! --What I told it to print

Game located children --What I told it to print
17:34:37.674 - Position is not a valid member of Model
17:34:37.675 - Script 'Workspace.Script', Line 24
17:34:37.675 - Stack End

✗ вυяиσυт699 » ɪGᴏᴛRᴇᴋᴛ
Report Abuse
iGotRekt is not online. iGotRekt
Joined: 23 Jan 2014
Total Posts: 831
29 Jan 2015 09:43 PM
I think I found the problem.

doorleft.Position = Vector3.new(doorleft.Position.x +5, doorleft.Position.y, doorleft.Position.z)
doorright.Position = Vector3.new(doorright.Position.x -5, doorright.Position.y, doorright.Position.z)

When I call this, I am calling the table's position, not what is in the table. So I should probably try and create another for b, c in pairs loop for the trade specifically!

✗ вυяиσυт699 » ɪGᴏᴛRᴇᴋᴛ
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