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: Follow Script

Previous Thread :: Next Thread 
bunnybunn263 is not online. bunnybunn263
Joined: 12 Sep 2007
Total Posts: 974
23 Nov 2011 01:26 PM
This script was for a figure I made to follow the nearest player.
It said there was a problem around the 18th line or so.
"Attempt to compare number to nil"
What is wrong with it? I put this script into the Humanoid.

while wait() do
Minimum=nil
Players=game.Players:GetPlayers()
for i=1,#Players do
if Minimum==nil then
if Players[i].Character then
if Players[i].Character.Torso then
if Players[i].Name=="bunnybunn263" then
else
if Players[i]:IsFriendsWith(60041) then
else
Minimum=Players[i]:DistanceFromCharacter(script.Parent.Parent.Torso.Position)
Target=Players[i].Character.Torso
end
end
end
end
elseif Players[i]:DistanceFromCharacter(script.Parent.Parent.Torso.Position) < Minumum then
if Players[i].Character then
if Players[i].Character.Torso then
if Players[i].Name=="bunnybunn263" then
else
if Players[i]:IsFriendsWith(60041) then
else
Minimum=Players[i]:DistanceFromCharacter(script.Parent.Parent.Torso.Position)
Target=Players[i].Character.Torso
end
end
end
end
end
end
if Target then
if Target==nil then
else
script.Parent:MoveTo(Target.Position,Target)
end
end
end
Report Abuse
tdog158 is not online. tdog158
Joined: 08 Jul 2008
Total Posts: 5413
23 Nov 2011 01:28 PM
You misspelled 'Minimum' in line 18.
Report Abuse
bunnybunn263 is not online. bunnybunn263
Joined: 12 Sep 2007
Total Posts: 974
23 Nov 2011 01:28 PM
This was the line something was wrong with:

elseif Players[i]:DistanceFromCharacter(script.Parent.Parent.Torso.Position) < Minumum then
Report Abuse
tdog158 is not online. tdog158
Joined: 08 Jul 2008
Total Posts: 5413
23 Nov 2011 01:29 PM
Correct, and you spelled minimum wrong.
Report Abuse
bunnybunn263 is not online. bunnybunn263
Joined: 12 Sep 2007
Total Posts: 974
23 Nov 2011 01:29 PM
Oops. I thought I spell-checked everything. :o
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