iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 09:19 PM |
function onClicked(hit) script.Parent.BrickColor = game.Players.LocalPlayer.TeamColor end script.Parent.Touched:connect(onClicked)
No output on hit. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Oct 2012 09:20 PM |
"game.Players.LocalPlayer"
that solves it. |
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 09:23 PM |
| How do you find the player without using localplayer? The script isn't in a tool, character model, etc so I can't make it a localscript. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Oct 2012 09:25 PM |
function onClicked(hit) script.Parent.BrickColor = hitTeamColor end script.Parent.Touched:connect(onClicked) |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Oct 2012 09:26 PM |
Opps lag.
function onClicked(hit) script.Parent.BrickColor = hit.TeamColor end script.Parent.Touched:connect(onClicked) |
|
|
| Report Abuse |
|
|
TenGauge
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 202 |
|
|
| 13 Oct 2012 09:26 PM |
script.Parent.Touched:connect(function(hit) local ffc = hit.Parent:findFirstChild("Humanoid") if ffc then x = hit.Parent:GetPlayerFromCharacter() -- This WILL break if you have other things with humanoids. end script.Parent.BrickColor = x.TeamColor end) |
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 09:28 PM |
| Trying both of yours. Thanks for the help. |
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 09:31 PM |
Xnite,
22:30:24.337 - Workspace.b1.Script:2: bad argument #3 to '?' (BrickColor expected, got nil)
|
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 09:32 PM |
@Ten
My game has other humanoids in it, so it won't work. Thanks, anyway. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Oct 2012 09:34 PM |
oppsies
forgot that it's in the character
function onClicked(hit) local player = hit:GetPlayerFromCharacter(new) script.Parent.BrickColor = new.TeamColor end script.Parent.Touched:connect(onClicked) |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Oct 2012 09:36 PM |
oppsies
it isn't in the player it's in the character..
function onClicked(hit) script.Parent.BrickColor = hit.TeamColor end script.Parent.Touched:connect(onClicked)
|
|
|
| Report Abuse |
|
|
TenGauge
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 202 |
|
|
| 13 Oct 2012 09:38 PM |
Fix:
script.Parent.Touched:connect(function(hit) name = hit.Parent.Name ffc = game.Players:findFirstChild(name) if ffc then script.Parent.BrickColor = x.TeamColor end end) |
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 09:38 PM |
22:38:32.165 - TeamColor is not a valid member of Part
|
|
|
| Report Abuse |
|
|
TenGauge
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 202 |
|
|
| 13 Oct 2012 09:39 PM |
Nevermind, I just saw Xnite's post. Anywho, Xnite's script will break if a brick touches it that isn't a character.
script.Parent.Touched:connect(function(hit) name = hit.Parent.Name ffc = game.Players:findFirstChild(name) if ffc then script.Parent.BrickColor = hit.Parent.TeamColor end end) |
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 09:42 PM |
22:42:36.541 - TeamColor is not a valid member of Model
|
|
|
| Report Abuse |
|
|
TenGauge
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 202 |
|
|
| 13 Oct 2012 09:47 PM |
Alright, it is the player, not character. I'm not going to repost becuase you can edit it. :P |
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 10:05 PM |
I don't think I can, lol.
script.Parent.Touched:connect(function(hit) name = hit.Parent.Name ffc = game.Players:findFirstChild(name) if ffc then script.Parent.BrickColor = hit:GetPlayerFromCharacter().TeamColor end end)
(Making myself look like an idiot because im still learning to script) |
|
|
| Report Abuse |
|
|
TenGauge
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 202 |
|
|
| 13 Oct 2012 10:07 PM |
That looks right.
script.Parent.Touched:connect(function(hit) name = hit.Parent.Name ffc = game.Players:findFirstChild(name) if ffc then script.Parent.BrickColor = ffc.TeamColor end end) |
|
|
| Report Abuse |
|
|
iPwnza
|
  |
| Joined: 13 Oct 2011 |
| Total Posts: 6139 |
|
|
| 13 Oct 2012 10:10 PM |
Time to act like I did during my first week on roblox...
OMG :D :D :D :D IT WORKS
OMG ALL U OTHER SCRIPTERS R NUBS EXPT 4 TENGADGE
OMG OMG OMG |
|
|
| Report Abuse |
|
|
vulture97
|
  |
| Joined: 09 Feb 2009 |
| Total Posts: 1589 |
|
|
| 14 Oct 2012 01:25 AM |
function youhaveterriblefunctiontitles (hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then toidi = game.Players:findFirstChild(hit.Parent.Name) script.Parent.BrickColor = toidi.TeamColor end
end
script.Parent.Touched:connect (youhaveterriblefunctiontitles) |
|
|
| Report Abuse |
|
|
TenGauge
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 202 |
|
|
| 15 Oct 2012 09:54 PM |
function thiswasalreadycompleted(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then toidi = game.Players:findFirstChild(hit.Parent.Name) script.Parent.BrickColor = toidi.TeamColor end end
script.Parent.Touched:connect(thiswasalreadycompleted) |
|
|
| Report Abuse |
|
|