cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 04:44 PM |
So, my script works perfectly, except for this...
if hit.Name == "Pea" then
end
I've checked out several forums and tried EVERYTHING!!! It just cannot do it! I think I'm doing the "if" statement wrong... Help? |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 04:47 PM |
It's fine. What is the error?
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 04:50 PM |
Post the entire code, if that's all the error is obvious.
hit is nil. |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 04:51 PM |
| That's the problem, there IS no error. It just doesn't do anything. |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 04:52 PM |
The script is
function onTouched(hit) if hit.Name == "Pea" then --Won't work... hit:Destroy() end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 04:54 PM |
make sure the object is named "Pea" and not "pea" or some silly inconsistency like that?
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 04:54 PM |
function onTouched(hit) if hit:IsA("BasePart") and hit.Name == "Pea" then --Won't work... hit:Destroy() print("Destroyed!") elseif hit:IsA("BasePart") then print('Brick got touched but it's not being destroyed. Instance:"'..hit.Name..'"') end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 04:57 PM |
1. Yes, the part is named "Pea".
2. That script did not work. |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 04:58 PM |
| Thanks, i would like to hear what it prints. |
|
|
| Report Abuse |
|
|
Elandorr
|
  |
| Joined: 25 Sep 2015 |
| Total Posts: 148 |
|
|
| 01 Oct 2015 05:02 PM |
| Script isn't disabled by chance is it? |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
| |
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
| |
|
|
| 01 Oct 2015 05:07 PM |
| Is the part touching it called Pea, or is the part in which the script itself is located called Pea? |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 05:09 PM |
| The part touching it is called pea |
|
|
| Report Abuse |
|
|
Elandorr
|
  |
| Joined: 25 Sep 2015 |
| Total Posts: 148 |
|
|
| 01 Oct 2015 05:12 PM |
| @cross haha see! its called "pea" not "Pea" change the name of the brick to "Pea"! |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 05:13 PM |
| is it a serversided script or a localscript |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 05:14 PM |
1. What? The part is called "Pea"... Idk what you're getting at...
2. Global script, not local |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 05:15 PM |
function onTouched(part) if part.Name == "Pea" then --Won't work... part:Destroy() end end
script.Parent.Touched:connect(onTouched)
try this??? |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 05:19 PM |
| That's just like my original script. No, it did not work |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Oct 2015 05:22 PM |
Is this a joke to get us to go in circles, or...
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 05:23 PM |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 05:25 PM |
Don't lisent to ninja, he don't have any idea at what he's saying.
However, is the part who's touching it NOT anchored? |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Oct 2015 05:26 PM |
| "Pea" (the part that's touching) IS anchored |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 05:27 PM |
Oh. Is the part that's detecting a touch anchored also?
-The [Guy] |
|
|
| Report Abuse |
|
|