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: Unsure why it doesn't work

Previous Thread :: Next Thread 
Aidy6666 is not online. Aidy6666
Joined: 17 Sep 2007
Total Posts: 2930
21 Nov 2011 07:36 PM
_G.Red and _G.Blue have already been defined

The problem is, is that after awhile, each of these points with this code in it, after awhile, I don't know why, just stops working. Anyone know why that might happen??

control = 0
distance = 10
while true do
if control > 0 then
script.Parent.BrickColor = BrickColor.new("Really red")
_G.Red = _G.Red + 1
elseif control < 0 then
script.Parent.BrickColor = BrickColor.new("Really blue")
_G.Blue = _G.Blue + 1
else
script.Parent.BrickColor = BrickColor.new("Light stone grey")
end
wait(1)
for a, b in pairs(game.Workspace:GetChildren()) do
if b.className == "Model" then
if game.Players:findFirstChild(b.Name) then
if game.Players[b.Name].TeamColor == BrickColor.new("Bright red") then
if control < 10 and (script.Parent.Position - b.Torso.Position).magnitude < distance then
control = control + 1
end
elseif game.Players[b.Name].TeamColor == BrickColor.new("Bright blue") then
if control > -10 and (script.Parent.Position - b.Torso.Position).magnitude < distance then
control = control - 1
end
end
end
end
end
end
Report Abuse
RackORibs is not online. RackORibs
Joined: 25 Apr 2011
Total Posts: 22
21 Nov 2011 07:42 PM
Have you gotten an error on the output?
Report Abuse
RoboTestGear is not online. RoboTestGear
Joined: 28 Dec 2009
Total Posts: 3063
21 Nov 2011 07:43 PM
_G or Shared isen't the best way to hold a number value, I'd hold it in a Instance.new("NumberValue")
Report Abuse
xSIXxStorage is not online. xSIXxStorage
Joined: 22 Aug 2010
Total Posts: 1811
21 Nov 2011 08:02 PM
@Robo

It does not matter. :l

@Thread Poster

Output?
Report Abuse
Aidy6666 is not online. Aidy6666
Joined: 17 Sep 2007
Total Posts: 2930
21 Nov 2011 08:24 PM
It works in singleplayer perfectly, have to do it in multiplayer, a bunch of them broke, except 1, (I have 8 of them), and we seem to be unable to break this last one, so does this code look like if there's more than 1 of these it would break anything? In singleplayer it worked fine though
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
21 Nov 2011 08:26 PM
Output please.
Report Abuse
Aidy6666 is not online. Aidy6666
Joined: 17 Sep 2007
Total Posts: 2930
21 Nov 2011 08:31 PM
works in singleplayer, not in multiplayer, so can't see output
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