Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 11 Mar 2013 03:12 PM |
--[[ XNITE ]]--
deb = false
deb1 = false
local teamcolors = { SC = BrickColor.new("Bright blue") or BrickColor.new("Bright green"),
Raider = BrickColor.new("Bright red")
}
_G["CP1"] = "nil"
script.Parent.Touched:connect(function(hit) if deb == false then deb = true if hit.Parent:findFirstChild("Humanoid") then plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then if plr.TeamColor == teamcolors["Raider"] and script.Control.Value == BrickColor.new("Bright blue") then for i = 60, 0 , -1 do print((hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude)) if (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) <= 3 then wait(1) print(i) if i == 0 then _G["CP1"] = "Raiders" script.Control.Value = BrickColor.new("Bright red") print(_G["CP1"]) script.Parent.BrickColor = BrickColor.new("Bright red") script.Parent.SpawnLocation.TeamColor = BrickColor.new("Bright red") elseif (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) >= 3 then break end -- here end end deb = false elseif plr.TeamColor == teamcolors["SC"] and script.Control.Value == BrickColor.new("Bright red") then for i = 60, 0 , -1 do print((hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude)) if (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) <= 3 then wait(1) print(i) if i == 0 then _G["CP1"] = "SC" script.Control.Value = BrickColor.new("Bright blue") print(_G["CP1"]) script.Parent.BrickColor = BrickColor.new("Bright blue") script.Parent.SpawnLocation.TeamColor = BrickColor.new("Bright blue") elseif (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) >= 3 then break end --HERE end end deb = false end end end end end) |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 11 Mar 2013 03:15 PM |
if plr.TeamColor == teamcolors["Raider"] and script.Control.Value == BrickColor.new("Bright blue") then for i = 60, 0 , -1 do print((hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude)) if (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) <= 3 then wait(1) print(i) if i == 0 then _G["CP1"] = "Raiders" script.Control.Value = BrickColor.new("Bright red") print(_G["CP1"]) script.Parent.BrickColor = BrickColor.new("Bright red") script.Parent.SpawnLocation.TeamColor = BrickColor.new("Bright red") elseif (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) >= 3 then break end -- here end end deb = false
and
elseif plr.TeamColor == teamcolors["SC"] and script.Control.Value == BrickColor.new("Bright red") then for i = 60, 0 , -1 do print((hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude)) if (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) <= 3 then wait(1) print(i) if i == 0 then _G["CP1"] = "SC" script.Control.Value = BrickColor.new("Bright blue") print(_G["CP1"]) script.Parent.BrickColor = BrickColor.new("Bright blue") script.Parent.SpawnLocation.TeamColor = BrickColor.new("Bright blue") elseif (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) >= 3 then break end --HERE |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2013 03:36 PM |
You have to end the if statement with "if i == 0" first, so that you can hook up the elseif with the corresponding if. Otherwise, it will never check if the distance is > 3, until the distance is less than three. This is what your code is like:
if Distance <= 3 then if i == 0 then elseif Distance >= 3 end end
You want to end the second if first:
if Distance <= 3 then if i == 0 then end elseif Distance >= end
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2013 03:37 PM |
You want to end the second if first:
if Distance <= 3 then if i == 0 then end elseif Distance >= 3 end
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 11 Mar 2013 03:48 PM |
thank you.
Now am having table problems?
--[[ XNITE ]]--
deb = false
deb1 = false
local spawn = { script.Parent.SpawnLocation }
local teamcolors = { ["SC"] = BrickColor.new("Bright blue") -- "or" sentences allowed ok - xnite
["Raider"] = BrickColor.new("Bright red")
}
_G["CP1"] = "nil" --my data is floating -xnite
script.Parent.Touched:connect(function(hit) if deb == false then deb = true if hit.Parent:findFirstChild("Humanoid") then plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then if plr.TeamColor == teamcolors["Raider"] and script.Control.Value == BrickColor.new("Bright blue") then for i = 60, 0 , -1 do print((hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude)) if (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) <= 1.2 then wait(1) print(i) elseif (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) >= 1.2 then deb = false break end if i == 0 then _G["CP1"] = "Raiders" script.Control.Value = BrickColor.new("Bright red") print(_G["CP1"]) for _,spawns in pairs(spawn:GetChildren()) do spawns.TeamColor = BrickColor.new("Bright red") end script.Parent.BrickColor = BrickColor.new("Bright red") deb = false end end elseif plr.TeamColor == teamcolors["SC"] and script.Control.Value == BrickColor.new("Bright red") then for i = 60, 0 , -1 do print((hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude)) if (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) <= 1.2 then wait(1) print(i) elseif (hit.Parent.Torso.Position.magnitude - script.Parent.Position.magnitude) >= 1.2 then deb = false break end if i == 0 then _G["CP1"] = "SC" script.Control.Value = BrickColor.new("Bright blue") print(_G["CP1"]) script.Parent.BrickColor = BrickColor.new("Bright blue") for _,spawns in pairs(spawn:GetChildren()) do spawns.TeamColor = BrickColor.new("Bright blue") -- allies ok end deb = false end end end end end end end) |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 11 Mar 2013 03:49 PM |
opps forgot the output:
Line15: '}' expected (to close '{' at line 11) near '='
|
|
|
| Report Abuse |
|
|
|
| 11 Mar 2013 03:49 PM |
Where's line 15?
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 11 Mar 2013 03:50 PM |
nevermind..
am so dumb. I forgot the comma.. |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2013 03:50 PM |
Oh.
local teamcolors = { ["SC"] = BrickColor.new("Bright blue"), --Comma here ["Raider"] = BrickColor.new("Bright red") }
¤ ¤ † K M <( •д• )> X D † ¤ ¤
|
|
|
| Report Abuse |
|
|