|
| 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
|
  |
| Joined: 16 Jul 2012 |
| Total Posts: 144 |
|
|
| 24 Jul 2012 09:54 AM |
| Is the 'reset' function defined? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 24 Jul 2012 10:39 AM |
Okay, I never knew about the GetPlayerFromCharacter method. Thanks for informing me about it.
-Nick |
|
|
| Report Abuse |
|
|