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

Certain weapon destroys certain objects?

Asked by 4 years ago
Edited 4 years ago

I was wondering how you could get a specific tool to be able to destroy certain objects. I am making a d-day game, and was wondering how I could get the Bangalore to destroy the barbed wire, but no other explosives could do that. I am very new to scripting and am asking for some pointers and some help.

1 answer

Log in to vote
0
Answered by 4 years ago

So, this might help you, basically what I've done was that I checked the object it touched.

--Insert this script into the object

while wait() do -- repeats the loop every time it waits a ccertain amount of time that roblox determines
    script.Parent.Touched:Connect(function(hit) -- the object that it touched
        if hit.Parent.Name == "barbed wire" then --Assuming that it is a model, if the parent of the object that it has touched has the name barbed wire or whatever you named it
            hit.Parent:Destroy()
        end
    end)
end
0
Thank you this will help me with my game, and help me learn more about scripting. Historical_pilot 2 — 4y
0
np alexfinger21 341 — 4y
Ad

Answer this question