Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to make a shootable wall (or part in general) that's destructible when shot?

Asked by
glxymo 6
3 years ago

Is it possible to make a shootable wall (or part in general) that's destructible when shot? I've tried out a lot of methods and they don't work. So my last resort is here. I'm working on a first-person shooter game. Any help I can get would be appreciated! Thanks! :)

Edit/Note: I think it would be a better idea if the part's destructibility ran on one script inserted into the part (because extra parts would cause lag spikes).

Note Two: I asked this question because the only destructibility I found only worked if the humanoid ran into the part/wall. I don't want that. I want it to work something like this explosive barrel where if you shoot it with any free modeled gun (I'm using warbound) it works and runs a script that makes it trigger the only difference is I don't want it to cause an explosion when shot I want it to be destroyed and to have the parts and debris fall to the ground.

Here's an example video of what I'm talking about: https://streamable.com/2ph1jy

(The models in the video are free models, I never got my head around making a script like that that's why I'm asking for support.)

(Currently, the Roblox Devforum is down for me once it starts working I'll probably post the same thing there as well.)

1 answer

Log in to vote
0
Answered by 3 years ago

Hello, Fellow Developer.

I am not a Professional but... I think it's 100% possible.

as I can see with the barrel it works with it. Try looking at the code and try to make it the same way but for the wall..

If you can see what is the thing that get's shoot out of the gun and get it's name maybe you can make it check if that thing touched it if it did then make all the listed part's fall.

I think you can compare the names like :

if p.Name == Bullet then

Here in an example code :

local part = script.Parent
local Bullet = "Bullet"
part.Touched:connect(function()
    local touching = part:GetTouchingParts() 
    local wall = script.Parent.Parent
    for _, p in next, touching do
        if p.Name == Bullet then
        print('Bullet is touching '..part.Name..'!')
        wall.Part.Anchored = false
        wall.Part1.Anchored = false
        wall.Part2.Anchored = false
        wall.Part3.Anchored = false
        wall.Part4.Anchored = false
        --ect...
        end 
    end
end)

Please talk to me in Discord and I'll be happy to help :D

  • Hamoodiyt#4822
Ad

Answer this question