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: Medium-Sized Script, Possibly Found Error?

Previous Thread :: Next Thread 
EgoRenascitur is not online. EgoRenascitur
Joined: 17 Nov 2013
Total Posts: 1049
17 Apr 2014 07:16 AM
Purpose: I'm trying to create a color-changing terminal. When captured by one team, the color of the terminal block will be White.

"Family Tree":
Part
..Script
....CountNum (A NumberValue)

Possible Error: It "might" be the repeat..until area that is messing up, since I normally don't use those, but I'm not 100% sure.


Script:

count = script.CountNum

script.Parent.Touched:connect(function(part)
for i, v in pairs(game.Players:GetChildren()) do
if ((v.Character.Torso.Position-script.Parent.Position).magnitude <= 35) then
if v.TeamColor == BrickColor.new("Navy blue") then
if count.Value < 10 then
repeat wait(1) count.Value = count.Value + 1 until count.Value >= 10
end
end
end
end
end)


script.Parent.Touched:connect(function(item)
for i, v in pairs(game.Players:GetChildren()) do
if ((v.Character.Torso.Position-script.Parent.Position).magnitude <= 35) then
if v.TeamColor == BrickColor.new("White") then
if count.Value <= 20 then
repeat wait(1) count.Value = count.Value - 1 until count.Value <= -10
end
end
end
end
end)

while count.Value >= -20 and count.Value < 0 do
if script.Parent.BrickColor ~= BrickColor.new("White") then
script.Parent.BrickColor = BrickColor.new("White")
end
end
Report Abuse
12packkid is not online. 12packkid
Joined: 24 Jun 2011
Total Posts: 1418
17 Apr 2014 07:19 AM
Okay, hi there, EgoRenascitur, I've just got one piece of valuable information that I must give you:

You've done the script.Touched function with out finding if it's a humanoid or not, meaning if someone shoots a bullet/object at the terminal (if it's an FPS) then it's say it's captured, when truly the bullet captured it.

Report Abuse
EgoRenascitur is not online. EgoRenascitur
Joined: 17 Nov 2013
Total Posts: 1049
17 Apr 2014 07:24 AM
@12

Actually it wouldn't, because if you look in the script - an actual player needs to be within a certain length for it to change.
Report Abuse
12packkid is not online. 12packkid
Joined: 24 Jun 2011
Total Posts: 1418
17 Apr 2014 07:25 AM
Very sorry, mate. Hope you don't mind.
Report Abuse
EgoRenascitur is not online. EgoRenascitur
Joined: 17 Nov 2013
Total Posts: 1049
17 Apr 2014 07:26 AM
It's alright but do you have any other idea it might not be working?
Report Abuse
12packkid is not online. 12packkid
Joined: 24 Jun 2011
Total Posts: 1418
17 Apr 2014 07:32 AM
Possibly not.
Only thing I could think of is if someone resets and glitches near the flag, since their torso wouldn't be in their character until their character loads, it would glitch the script up.
Report Abuse
EgoRenascitur is not online. EgoRenascitur
Joined: 17 Nov 2013
Total Posts: 1049
17 Apr 2014 07:33 AM
@12

I have no idea if that would happen, but it still doesn't work even before people die.
Report Abuse
EgoRenascitur is not online. EgoRenascitur
Joined: 17 Nov 2013
Total Posts: 1049
17 Apr 2014 07:50 AM
Bump
Report Abuse
EgoRenascitur is not online. EgoRenascitur
Joined: 17 Nov 2013
Total Posts: 1049
17 Apr 2014 08:18 AM
I fixed the script. Apparently the while...do area broke the script. I changed it out with "script.CountNum.Changed:connect(function(Val)" and it's all fixed.
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