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: Condition problem

Previous Thread :: Next Thread 
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
12 Aug 2013 07:57 PM
Well, I'm trying to find the right way to write the following syntax:

if humanoid ~= nil and not script.Parent.team.Value == hit.Parent.Parent then

It's a condition within the Paintball gun that can sense Team Color from the Player, And then cancel out if the team colors are equal. The script said it was written fine but it doesn't look right IMO.

Also, You CAN'T TEST this in Studio.

Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
12 Aug 2013 07:59 PM
Studio:

Tools:

Test:

Start Server

----After that


Studio:

Tools:

Test:

Start Player x2


There you go :P
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
12 Aug 2013 08:00 PM
Ok, but can you say the syntax is correct?
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
12 Aug 2013 08:03 PM
if humanoid ~= nil then
if not script.Parent.team.Value == hit.Parent.Parent then


end

end

--You might want to check for those...but unless humanoid is predefined earlier it
--won't work, also, how would hit.Parent.Parent be set to a team if you are
--shooting at a player???/????

--I would recommend doing a better check than that...but other than the
--questioning of your script, that should be correct.
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
12 Aug 2013 08:11 PM
Yeah, the paintball gun shoots at players spesifically. To make it work that way you have to do this syntax:

game.Players:playerFromCharacter()

Players include teams, if you use the explorer and open the properties of player.

Thanks for your help though, much appreciated.
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
12 Aug 2013 08:12 PM
I am not sure if there is a 'playerFromCharacter()'

I believe it is game.Players:GetPlayerFromCharacter(objectValue)
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
12 Aug 2013 08:15 PM
I'll look into it. Perhaps same term in different phrasing?
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
12 Aug 2013 08:17 PM
Different but if you use 'playFromCharacter()' your script will not function.
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