Dwayder
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 283 |
|
|
| 30 Apr 2016 08:45 AM |
if script.Parent.Touched.Name == "Player1" then script.Parent.CanCollide = false end
what's wrong? when i say "touched", do i refer to the touched object or the thing that touches the object? Thanks |
|
|
| Report Abuse |
|
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
|
| 30 Apr 2016 08:47 AM |
I tried this in studio and it works.
function touched(hit) h = hit.Parent if h.Name == ("Player1") then script.Parent.CanCollide = false end end
script.Parent.Touched:connect(touched)
R$4,668 In america, you eat tickets. In soviet Russia, tickets, eat you! |
|
|
| Report Abuse |
|
|
|
| 30 Apr 2016 08:50 AM |
You need to set up an event. That code will only run once, and error because that's not how it works.
script.Parent.Touched:connect(function(Hit) if Hit.Parent.Name == "Player1" and script.Parent.CanCollide then -- Check the name and make sure it doesn't run more than once at a time. script.Parent.CanCollide = false wait(2) -- Door stays open for two seconds. script.Parent.CanCollide = true end end) |
|
|
| Report Abuse |
|
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
|
| 30 Apr 2016 08:50 AM |
Actually, use jared's if you want it to close again. Mine only works once :P. Good luck!
R$4,668 In america, you eat tickets. In soviet Russia, tickets, eat you! |
|
|
| Report Abuse |
|
|
Dwayder
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 283 |
|
| |
|
|
| 30 Apr 2016 08:52 AM |
| At the top of my post I was talking about the original poster, but yeah, yours wouldn't close again. |
|
|
| Report Abuse |
|
|
|
| 30 Apr 2016 08:52 AM |
| No problem, and good luck on your coding. :) |
|
|
| Report Abuse |
|
|