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: TeamColor

Previous Thread :: Next Thread 
AdvorsusDuo is not online. AdvorsusDuo
Joined: 17 May 2012
Total Posts: 5265
24 Jul 2012 09:52 AM
--This script is not working, and there is no output.

function OnTouch(Hit)
local Team = Hit.Parent.Parent:FindFirstChild("TeamColor")
if Team ~= nil then
if Team.TeamColor == BrickColor.new ("Dark green") then
if tracap == false then
captured = true
tracap = true
raidcap = false
mpcap = false
hrcap = false
allycap = false
script.Parent.BrickColor = BrickColor.new ("Dark green")
script.Parent.Parent.Head.BrickColor = BrickColor.new ("Dark green")
owner.Name = "Owned by TRA"
reset()
end
end
end
end

script.Parent.Touched:connect(OnTouch)
Report Abuse
Windburnt is not online. Windburnt
Joined: 16 Jul 2012
Total Posts: 144
24 Jul 2012 09:54 AM
Is the 'reset' function defined?
Report Abuse
bourlo is not online. bourlo
Joined: 11 Aug 2009
Total Posts: 399
24 Jul 2012 10:05 AM
local Team = Hit.Parent.Parent:FindFirstChild("TeamColor")

is that a Value?
Report Abuse
AdvorsusDuo is not online. AdvorsusDuo
Joined: 17 May 2012
Total Posts: 5265
24 Jul 2012 10:10 AM
Reset is defined later in the script.

The parent of Hit should be the character right? So the parent of the character is the player, correct? I may be wrong.
Report Abuse
bourlo is not online. bourlo
Joined: 11 Aug 2009
Total Posts: 399
24 Jul 2012 10:13 AM
ow,no the parent of character is workspace,to get the player you need to use the GetPlayerFromCharacter method so it would be

player = game.Players:GetPlayerFromCharacter(Hit.Parent)
Report Abuse
bourlo is not online. bourlo
Joined: 11 Aug 2009
Total Posts: 399
24 Jul 2012 10:15 AM
function OnTouch(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player ~= nil then
if Player.TeamColor == BrickColor.new ("Dark green") then
if tracap == false then
captured = true
tracap = true
raidcap = false
mpcap = false
hrcap = false
allycap = false
script.Parent.BrickColor = BrickColor.new ("Dark green")
script.Parent.Parent.Head.BrickColor = BrickColor.new ("Dark green")
owner.Name = "Owned by TRA"
reset()
end
end
end
end
Report Abuse
AdvorsusDuo is not online. AdvorsusDuo
Joined: 17 May 2012
Total Posts: 5265
24 Jul 2012 10:39 AM
Okay, I never knew about the GetPlayerFromCharacter method. Thanks for informing me about it.

-Nick
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