|
| 30 Apr 2016 10:29 AM |
function onTouch() script.Parent.Touched if game.Players.LocalPlayer.TeamColor = game.Teams.Cops.TeamColor then script.Parent.Transparency = 0.5 end |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 30 Apr 2016 10:31 AM |
everything
local player = game.Players.LocalPlayer local brick = script.Parent local debounce = false
function onTouch() if not debounce then debounce == true if player.TeamColor == game:GetService("Teams").Cops.TeamColor then brick.Transparency = 0.5 end wait(1) debounce = false brick.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 30 Apr 2016 10:32 AM |
I assume you're trying to use a .Touched event
function onTouch(hit) if hit.Parent:FindFirstChild("Torso") then player = hit.Parent:GetPlayerFromCharacter() if player.TeamColor == game.Teams.Cops.TeamColor then script.Parent.Transparency = 0.5 end end end
script.Parent.Touched:connect(onTouch)
I think this is what you're going for. |
|
|
| Report Abuse |
|
|
|
| 30 Apr 2016 10:33 AM |
| @Sal local player probably won't work since this script is in a part. |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 30 Apr 2016 10:34 AM |
I totally didnt forget to pass the hit argument
local brick = script.Parent local debounce = false
brick.Touched:connect(function(hit) if not debounce then debounce == true local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then if player.TeamColor == game:GetService("Teams").Cops.TeamColor then brick.Transparency = 0.5 end end wait(1) debounce = false end end)
|
|
|
| Report Abuse |
|
|
Vortius
|
  |
| Joined: 05 Apr 2014 |
| Total Posts: 861 |
|
|
| 30 Apr 2016 10:35 AM |
| everything... everything is wrong... |
|
|
| Report Abuse |
|
|
lululukas
|
  |
| Joined: 23 Aug 2010 |
| Total Posts: 1043 |
|
|
| 30 Apr 2016 10:37 AM |
@OP I don't even know where to begin.
@Salinas you did == instead of = on the debounce. |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 30 Apr 2016 10:37 AM |
I've been confusing a lot recently between = and ==
but you get the point and thats a vague tiny mistake |
|
|
| Report Abuse |
|
|
| |
|
lululukas
|
  |
| Joined: 23 Aug 2010 |
| Total Posts: 1043 |
|
|
| 30 Apr 2016 10:39 AM |
| I do, but obviously he wouldn't |
|
|
| Report Abuse |
|
|
|
| 30 Apr 2016 10:41 AM |
@Sal I just think of = being equals and == as is equal to.
It works for me :P |
|
|
| Report Abuse |
|
|
Marienus
|
  |
| Joined: 02 Jul 2012 |
| Total Posts: 118 |
|
|
| 30 Apr 2016 10:41 AM |
function onTouch(hit) if script.Parent:FindFirstChild("Humanoid") then if game.Players[hit.Parent.Name].TeamColor == game.Teams.Cops.TeamColor then script.Parent.Transparency = 0.5 end end end
script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
Marienus
|
  |
| Joined: 02 Jul 2012 |
| Total Posts: 118 |
|
|
| 30 Apr 2016 10:42 AM |
I made a mistake in my previous reply
function onTouch(hit) if hit.Parent:FindFirstChild("Humanoid") then if game.Players[hit.Parent.Name].TeamColor == game.Teams.Cops.TeamColor then script.Parent.Transparency = 0.5 end end end
script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 30 Apr 2016 10:45 AM |
thats it
local brick = script.Parent local debounce = false
brick.Touched:connect(function(hit) if not debounce then debounce = true local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then if player.TeamColor == game:GetService("Teams").Cops.TeamColor then brick.Transparency = 0.5 end end wait(1) debounce = false end end)
|
|
|
| Report Abuse |
|
|
| |
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
| |
|
Silicti
|
  |
| Joined: 07 Nov 2012 |
| Total Posts: 8242 |
|
|
| 30 Apr 2016 10:58 AM |
| did you put the script in the part |
|
|
| Report Abuse |
|
|
| |
|
Silicti
|
  |
| Joined: 07 Nov 2012 |
| Total Posts: 8242 |
|
|
| 30 Apr 2016 11:02 AM |
| can you add me to the team create, and give me the link |
|
|
| Report Abuse |
|
|