|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1418 |
|
|
| 17 Apr 2014 07:25 AM |
| Very sorry, mate. Hope you don't mind. |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2014 07:26 AM |
| It's alright but do you have any other idea it might not be working? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|