A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 10:47 AM |
| How do i prevent weapons like a m16 which uses bullets to not shoot through walls. im having problems where my weapons r shooting throught my walls which are stone bricks made up of concrete materials. im not sure how to prevent this, plz help!!! |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 08 Aug 2011 11:42 AM |
1) Use grammar 2) Add this script to every wall that is going to be bullet proof
function hi(hit)
local bullet={"Bullet","Paintball","bullet","paintball","ball","Ball"} --add in bullet names
if (hit.Parent.Name=bullet) then
hit.Parent:Remove() end end
script.Parent.Touched:connect(hi)
3) I never used a table before but from looking at other scripts this should work. |
|
|
| Report Abuse |
|
|
| |
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 12:15 PM |
| that script did not work. my gun uses Bullet and i put the script into the wall part, but nothing happened, i still was able to shoot thru the wall!!!!! =( |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 08 Aug 2011 12:41 PM |
| Did you add the name of the bullet into the table? |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 12:47 PM |
| its already there, isnt it? where u list the types of bullets. my gun has a script called bullets. is that wat im suppoes to add to the script? |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 08 Aug 2011 12:53 PM |
| Look in the firing script for something like i=Instance.new("Part") or something and post here everything involving that i. |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 01:02 PM |
ok, i found this in a script called bullet in my m16 :
if hit:findFirstChild("Metal") ~= nil and hitt == false then hitt = true for i = 1,math.random(1,3) do local j = Instance.new("Part") j.formFactor = "Plate" j.Size = Vector3.new(1,.4,1) j.BrickColor = BrickColor.new("Bright yellow") j.CanCollide = false j.Velocity = Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10)) j.CFrame = script.Parent.CFrame j.Parent = game.Workspace end end
and where it says j.CanCollide=false, i changed it to true.
if hit:findFirstChild("Metal") ~= nil and hitt == false then hitt = true for i = 1,math.random(1,3) do local j = Instance.new("Part") j.formFactor = "Plate" j.Size = Vector3.new(1,.4,1) j.BrickColor = BrickColor.new("Bright yellow") j.CanCollide = true j.Velocity = Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10)) j.CFrame = script.Parent.CFrame j.Parent = game.Workspace end end
Is that wat u meant? |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 08 Aug 2011 01:04 PM |
| When the bullet fires does it look like a plate? |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 01:09 PM |
| for my P91, i dont see the bullets, for my m16, it looks like balls |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
| |
|
|
| 08 Aug 2011 03:05 PM |
For the script, add this line.
j.Name = "Bullet"
-ultralegomaster5096, the guy who just ate ur cookie. |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 03:06 PM |
| ok, so i add j.Name = Bullet and then i add the script above to the walls, right? |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2011 03:08 PM |
No, you add it to the bullet script. Then it should work.
-ultralegomaster5096, the guy who just ate ur cookie. |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 03:10 PM |
| but how will adding the name do any different? |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 03:14 PM |
| i added the name to the guna and there is nothing in my walls, but i can stilll kill ppl thought the walls. HELP!!! |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2011 03:22 PM |
@theopfor it should be function hi(hit)
local bullet={"Bullet","Paintball","bullet","paintball","ball","Ball"} --add in bullet names
if (hit.Parent.Name=bullet) then
hit.Parent:Remove() end end
script.Parent.Touched:connect(hit) not function hi(hit)
local bullet={"Bullet","Paintball","bullet","paintball","ball","Ball"} --add in bullet names
if (hit.Parent.Name=bullet) then
hit.Parent:Remove() end end
script.Parent.Touched:connect(hi)
see if that works. |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2011 03:27 PM |
Oops, nevermind. Are you sure it's supposed to be touched.Parent? |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2011 03:56 PM |
is it if (hit.Parent.Name==bullet) then
not if (hit.Parent.Name=bullet) then?
I'm not sure Xp |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 08 Aug 2011 04:19 PM |
| Ug mixing habits. C++ and lua their basics are pretty much the same but when it comes to logical operators. |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 08 Aug 2011 05:23 PM |
| when i tested the script. i got that = is expected near ). so i put the xtra = sign, but nothing happened, the output disapeared, but i was still able to shoot through. funny how its so dificult to do 1 thing which seems easy!!!! LMAO. BUMP |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2011 05:33 PM |
Here's what the script in the bullet should look like.
if hit:findFirstChild("Metal") ~= nil and hitt == false then hitt = true for i = 1,math.random(1,3) do local j = Instance.new("Part") j.formFactor = "Plate" j.Name = "Bullet" j.Size = Vector3.new(1,.4,1) j.BrickColor = BrickColor.new("Bright yellow") j.CanCollide = true j.Velocity = Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10)) j.CFrame = script.Parent.CFrame j.Parent = game.Workspace end end
Man it feels good to do scripting in BH! -ultralegomaster5096, the guy who just ate ur cookie. |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
|
| 09 Aug 2011 03:44 AM |
| @ultraleg... thats how i made the gun script look like, but it still shoots through the walls!!!-.- =( nothing seems to work. |
|
|
| Report Abuse |
|
|
A22asin
|
  |
| Joined: 04 Jul 2011 |
| Total Posts: 313 |
|
| |
|
|
| 09 Aug 2011 07:26 PM |
Man, it don't like you then. Also, the script goes in the M16, NOT the wall.
-ultralegomaster5096, the guy who just ate ur cookie. |
|
|
| Report Abuse |
|
|