|
| 14 Apr 2014 04:38 PM |
| Is it possible to have a door that is "neutral" at first, until a team member touches the door and it become a door for that specific team? |
|
|
| Report Abuse |
|
|
HalfPrint
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 26981 |
|
| |
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 14 Apr 2014 05:00 PM |
door = script.Parent door_team = Instance.new("BrickColorValue", door).Value = BrickColor.Gray() debounce= false
door.Touched:connect(function(hit) if debounce == false then debounce = true local c = hit.Parent:FindFirstChild("Humanoid") local p if c then p = game.Players:GetPlayerFromCharacter(hit.Parent) door_team.Value = p.TeamColor end else door.CanCollide = false door.Transparency = 0.5 wait(3) door.CanCollide = true doot.Transparency = 1 end end)
hiiiiii |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 14 Apr 2014 05:05 PM |
Wait, no, let me correct it.
door = script.Parent door_team = Instance.new("BrickColorValue", door).Value = BrickColor.Gray() debounce= false debounce2 = false
door.Touched:connect(function(hit) local c = hit.Parent:FindFirstChild("Humanoid") local p if c then p = game.Players:GetPlayerFromCharacter(hit.Parent) end if not c or debounce2 then return end
if debounce == false then debounce = true door_team.Value = p.TeamColor
elseif debounce and door_team.Value == p.TeamColor debounce2 = true door.CanCollide = false door.Transparency = 0.5 wait(3) door.CanCollide = true door.Transparency = 1 debounce2 = false
end end)
Try that |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2014 05:08 PM |
| Thanks! So I just name the brick "Door", right? |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2014 05:11 PM |
| Oh I found an error in the script for door_team. |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 14 Apr 2014 05:20 PM |
| I'll check it out in the studio |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 14 Apr 2014 05:23 PM |
door = script.Parent door_team = Instance.new("BrickColorValue", door) door_team.Value = BrickColor.Gray() debounce= false debounce2 = false
door.Touched:connect(function(hit) local c = hit.Parent:FindFirstChild("Humanoid") local p if c then p = game.Players:GetPlayerFromCharacter(hit.Parent) end if not c or debounce2 then return end
if debounce == false then debounce = true door_team.Value = p.TeamColor
elseif debounce and door_team.Value == p.TeamColor then debounce2 = true door.CanCollide = false door.Transparency = 0.5 wait(3) door.CanCollide = true door.Transparency = 0 debounce2 = false
end end)
There you go, all fixed. Works quite nicely if I do say so myself, :-P |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2014 05:50 PM |
| THANK YOU SO MUCH! YOU DA MASTER OF SCRIPTING BRO! :D |
|
|
| Report Abuse |
|
|