Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 27 Nov 2012 10:20 PM |
So I just made a door and I want to be the only one able to go through it. So this seems like a simple script right? Well I can't get it to work and I don't want to use someone else's. So here is my script: function ontouched(hit) if hit.Parent = "Hazania" then script.Parent.CanCollide = false wait(3) script.Parent.CanCollide = true else end end script.Parent.Touched:connect(ontouched) |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 10:21 PM |
if hit.Parent.Name* ==* "Hazania" then
|
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 27 Nov 2012 10:32 PM |
Script now read as follows:
function ontouched(hit) if hit.Parent.Name == "Hazania" then script.Parent.CanCollide = false wait(3) script.Parent.CanCollide = true end end script.Parent.Touched:connect(ontouched)
Still doesn't work. Although something was done right because now the touch interest actually appears. |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 10:34 PM |
try
function ontouched(hit) if (hit.Parent.Name == "Hazania") then script.Parent.CanCollide = false wait(3) script.Parent.CanCollide = true end end script.Parent.Touched:connect(ontouched)
but you must know if your doing this in play solo your name will be Player. |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 10:35 PM |
script.Parent.Touched:connect(function(hit) h = hit.Parent if h.Name == "Workspace" then return end if hit.Parent.Name == "Hazania" then script.Parent.CanCollide = false wait(3) script.Parent.CanCollide = true end end)
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 10:37 PM |
@thedeath
Moving the connect to the top doesnt change anything. And how does the workspace touch the door? |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 10:40 PM |
"if h.Name == "Workspace" then return end" He did that to make sure the part touching it was in a model. I think. |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 10:45 PM |
@christheoneuknow, Making sure that the item touching was a model. @screw, yep :P
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 10:58 PM |
Then he has no idea what he is doing.
h.Parent.Name Bro, it can't be the workspace. The workspace can't touch things.
Lrn2Script
-~Obly of C&G~- |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 11:02 PM |
@Ghost, I was saying that a brick could touch it that is not in a model. I know how to script, if you look at my places, thank you very much
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 11:19 PM |
h.Name == "Workspace"
That's proof that you don't. Kthx. Gobwey.
-~Obly of C&G~- |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 11:32 PM |
You can't understand a simple mistake?
You should go away, I have been in scripting helpers longer than you and that 'h.Name == "Workspace"' was an accident. Just because I made a mistake doesn't mean I can't script.
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 11:33 PM |
script.Parent.Touched:connect(function(hit) h = hit.Parent if h.Parent.Name == "Workspace" then return end if hit.Parent.Name == "Hazania" then script.Parent.CanCollide = false wait(3) script.Parent.CanCollide = true end end)
you happy fail troll?
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2012 11:55 PM |
You obviously haven't been in scripting helpers long enough to spot an alt. Kthx. Also, you dun goofed, and didn't use a variable.
h = hit.Parent if h.Parent.Name == "Workspace" then return end if hit.Parent.Name == "Hazania" then
h is hit.Parent
and then, you refer to hit.Parent
Declaring variables and then not using them is derp, bro. Derp.
-~Obly of C&G~- |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2012 09:23 AM |
What's you to prove that I've not been here longer, ask miz656, ElectricBlaze, knightmareXD, and 18cwatford and they'll say I've been here way longer than you. Also, why get so worked up about one little mistake.
Goodbye fail troll.
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2012 09:24 AM |
People also have different ways of scripting that works. I don't have to script the way you tell me to. I can script however I want, so if I clarify variables and only use them once, then so be it.
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2012 04:49 PM |
>corrects someone >has a mistake in his correction that makes the script not work >says he knows what he's doing |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2012 05:39 PM |
lol @christ
http://www.youtube.com/watch?v=m0iNzj6gTlE&NR=1&feature=fvwp |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 28 Nov 2012 07:01 PM |
| Well thanks guys, you helped me out. :D |
|
|
| Report Abuse |
|
|