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
 

Why won't this magnitude script work?

Previous Thread :: Next Thread 
SlyCat123123Sly123 is not online. SlyCat123123Sly123
Joined: 09 Aug 2010
Total Posts: 663
09 Jul 2011 03:49 PM
function poses()
pos1 = game.Workspace.Part.Position
pos2 = game.Workspace.Part2.Position
if (pos1 - pos2).magnitude > 10 then
pos1:remove()
pos2:remove()
end
poses()
end

No, output...
Report Abuse
61352151511 is not online. 61352151511
Joined: 30 Nov 2009
Total Posts: 8094
09 Jul 2011 03:50 PM
Let me try it, I don't think there are any errors in it

~ Mitch ~
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 03:51 PM
Try this,

function poses()
pos1 = game.Workspace.Part.Position
pos2 = game.Workspace.Part2.Position
if (pos1 - pos2).magnitude > 10 then
pos1:remove()
pos2:remove()
elseif (pos1 - pos2).magnitude <= 10 then
poses()
end
end
Report Abuse
61352151511 is not online. 61352151511
Joined: 30 Nov 2009
Total Posts: 8094
09 Jul 2011 03:51 PM
Wait, probably because you called poses in the wrong spot. It should be

end
end
poses()

~ Mitch ~
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
09 Jul 2011 03:51 PM
[ Content Deleted ]
Report Abuse
SlyCat123123Sly123 is not online. SlyCat123123Sly123
Joined: 09 Aug 2010
Total Posts: 663
09 Jul 2011 03:51 PM
pos1 = game.Workspace.Part.Position
pos2 = game.Workspace.Part2.Position
function poses()
if (pos1 - pos2).magnitude < 10 then
pos1:remove()
pos2:remove()
end
poses()
end

I also tried that... That really should of worked...
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 03:52 PM
I think he wants it to be recursive so if a part gets within that range they are removed.
Report Abuse
Vultraz is not online. Vultraz
Joined: 03 Jul 2008
Total Posts: 1289
09 Jul 2011 03:52 PM
Maybe you should do a while loop to constantly recheck..?
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
09 Jul 2011 03:53 PM
[ Content Deleted ]
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 03:53 PM
Try this instead, 2nd attempt :

function poses()
pos1 = game.Workspace.Part
pos2 = game.Workspace.Part2
if (pos1.Position - pos2.Position).magnitude > 10 then
pos1:remove()
pos2:remove()
end
poses()
end
Report Abuse
61352151511 is not online. 61352151511
Joined: 30 Nov 2009
Total Posts: 8094
09 Jul 2011 03:53 PM
Found the error. You are calling remove on the position, not the part

~ Mitch ~
Report Abuse
Vultraz is not online. Vultraz
Joined: 03 Jul 2008
Total Posts: 1289
09 Jul 2011 03:53 PM
No, I'm pretty sure it's end end poses()
Report Abuse
SlyCat123123Sly123 is not online. SlyCat123123Sly123
Joined: 09 Aug 2010
Total Posts: 663
09 Jul 2011 03:53 PM
When I put it there I got this error:


Sat Jul 09 16:51:49 2011 - remove is not a valid member
Sat Jul 09 16:51:49 2011 - Workspace.Script, line 5 - global poses Workspace.Script, line 9 stack end
Sat Jul 09 16:51:49 2011 - Workspace.Script, line 5 - global poses Workspace.Script, line 9 stack end


I tried to put the pose there first, but I got that...
Report Abuse
61352151511 is not online. 61352151511
Joined: 30 Nov 2009
Total Posts: 8094
09 Jul 2011 03:54 PM
Exactly, look at my last post

~ Mitch ~
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 03:54 PM
Hey guys, when a function calls itself, it's RECURSIVE.

function example(asd)
print(asd)
wait(.1)
example(asd)
end
example("lol")

> lol
> lol
> lol
> lol
> lol
> lol
> lol
> lol
> lol
...
Report Abuse
SlyCat123123Sly123 is not online. SlyCat123123Sly123
Joined: 09 Aug 2010
Total Posts: 663
09 Jul 2011 03:55 PM
OH MY GOD, thank you crazy and 613! I forgot Position can't be removed. I was trying to remove the part... Dur. LOL!
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 03:56 PM
0mG ; h4x hao nnune notice that D:
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