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: What is wrong with the if statement?

Previous Thread :: Next Thread 
darkwisp is not online. darkwisp
Joined: 07 Apr 2010
Total Posts: 22653
30 Dec 2013 12:10 PM
Once I added the if statement checking the players team color. It stopped working.
------------------------------------------------------
Turn = game.Workspace.DefenderTeamTurn.Value
local CD = script.Parent
local function onMouseClick(Player)
local Brick = CD.Parent
if Brick:IsA("BasePart") then
if Player.Character.Energy.Value > 5 then
if Turn == true then
if Player.TeamColor == ("Bright violet") then
print("Legit")
Player.Character.Energy.Value = Player.Character.Energy.Value - 5
Player.Character.Torso.CFrame = Brick.CFrame
end
end
if Turn == false then
if Player.TeamColor == ("Really red") then
print("Legit")
Player.Character.Energy.Value = Player.Character.Energy.Value - 5
Player.Character.Torso.CFrame = Brick.CFrame
end
end

end
end
end

CD.MouseClick:connect(onMouseClick)
----------------------------------------------------

{_=-::Vekronian Guard::]-=_}
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
30 Dec 2013 12:11 PM
if Player.TeamColor == BrickColor.new("Bright violet") then
-- stuff
end



The TeamColor property actually contains a BrickColor value.
Report Abuse
lukey1111 is not online. lukey1111
Joined: 28 Feb 2009
Total Posts: 8
30 Dec 2013 12:15 PM
Umm... You have too many if's.
Report Abuse
broccoli7040 is not online. broccoli7040
Joined: 30 Jul 2009
Total Posts: 22
30 Dec 2013 12:27 PM
dont listen to lurky its impossible to have to many if's XD
Report Abuse
darkwisp is not online. darkwisp
Joined: 07 Apr 2010
Total Posts: 22653
30 Dec 2013 12:45 PM
@lukey
I dont even.... Have you seen most turn based strategy games?

{_=-::Vekronian Guard::]-=_}
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