|
| 18 Oct 2016 09:17 PM |
Im trying to make a part move along a path of many little parts, and when the moving part hits something, the thing it hit is removed. The move function works, but not the "hit" function.
On = false
function DynamiteOn() if On == false then On = true while true do if On == true then script.Parent.FirePart.CFrame = script.Parent.FirePart.CFrame + Vector3.new(-0.2, 0, 0) wait(0.1) end end end end
script.Parent.Button.ClickDetector.MouseClick:connect(DynamiteOn)
function DynamiteHitSomething(touched) if On == true then if touched.Parent:FindFirstChild("Humanoid") then elseif touched.Parent == "Workspace" then touched:Destroy() end end end
script.Parent.FirePart.Touched:connect(DynamiteHitSomething) |
|
|
| Report Abuse |
|
|
Burglered
|
  |
| Joined: 14 Jul 2011 |
| Total Posts: 962 |
|
|
| 18 Oct 2016 09:21 PM |
"if touched.Parent:FindFirstChild("Humanoid") then"
I thought you were deleting parts, not characters
|
|
|
| Report Abuse |
|
|
|
| 18 Oct 2016 09:22 PM |
| Yes, but I have the else if there so it doesn't affect anything. Ignore that part |
|
|
| Report Abuse |
|
|
|
| 18 Oct 2016 09:24 PM |
| I have that there because later on I am going to add some stuff if it detects a character, if your wondering. |
|
|
| Report Abuse |
|
|
|
| 18 Oct 2016 09:26 PM |
"if touched.Parent:FindFirstChild("Humanoid") then elseif touched.Parent == "Workspace" then touched:Destroy() end"
This will not do anything right now if it is a character, because the script is not told to.
However, if the touched thing is a child of workspace, parts not in a model, then it will be destroyed. |
|
|
| Report Abuse |
|
|
|
| 18 Oct 2016 09:33 PM |
| Bump, it can't be that hard to help a new scripter out |
|
|
| Report Abuse |
|
|