|
| 25 Dec 2015 03:01 AM |
For some reason, this always returns "Error":
capturable = true function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") local name = part.Parent.Name if not human then return end if game.Players[name].TeamColor == BrickColor.new("Black") then if capturable == true then capturable = false script.Parent.Parent.InStand.Value = false local FlagClone = script.Parent.Parent.ELFLAG:Clone() script.Parent.Parent.ELFLAG.Transparency = 1 FlagClone.Parent = human.Parent local weld = Instance.new("Weld",FlagClone) weld.Part0 = human.Parent.Torso weld.Part1 = FlagClone weld.C0 = CFrame.new(-1,0,0.5) weld.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0),math.rad(0),math.rad(30)) FlagClone.Anchored = false local HasFlag = Instance.new("BoolValue",game.Players[name]) HasFlag.Value = true HasFlag.name = "HasFlag" end elseif game.Players[name].TeamColor == BrickColor.new("Gold") then print "Returning Flag" else print "Error" end end script.Parent.Touched:connect(onTouch)
~IanSplodge, Destroyer of Souls. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 03:12 AM |
The player can only ever be on the Gold or Black team, yet it still prints "Error" regardless. I fail to see what I'm doing wrong.
~IanSplodge, Destroyer of Souls. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 06:15 AM |
bump
~IanSplodge, Destroyer of Souls. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 06:17 AM |
The game is here: http://www.roblox.com/games/335394849/Fort-Tech-Test
~IanSplodge, Destroyer of Souls. |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 25 Dec 2015 06:47 AM |
most likely a hat's/tool's handle is touching it
try these changes
local plr = game.Players:GetPlayerFromCharacter(part.Parent) or game.Players:GetPlayerFromCharacter(part.Parent.Parent)
...
if plr.TeamColor == BrickColor.new("Black") then ... elseif plr.TeamColor == BrickColor.new("Gold") then |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 25 Dec 2015 06:49 AM |
| also throw that humanoid check out and check plr instead |
|
|
| Report Abuse |
|
|