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

When making a sensitive bomb, how do you make a radius?

Asked by
oGxbe 0
8 years ago

I'm attempting to make Proximity mines and I'm unsure if I'm correct on the coding of it. I just needed it to be that if someone is within 3 studs the mine goes off.

0
I'm unsure what you are on about. UniversalDreams 205 — 8y

1 answer

Log in to vote
1
Answered by
StoIid 364 Moderation Voter
8 years ago

If you are trying to make a simple Land Mine type object, we can do this!

local debounce = true -- Just to use as a cooldown
local Respawn = 10 --How long it takes for the LandMine to come back

script.Parent.Touched:connect(function(plr)
    if plr.Parent:FindFirstChild('Humanoid') ~= nil then --Making sure it was a player that touched the Mine
    if debounce == true then --Making sure this doesn't fire before our cooldown is finished
    debounce = false
        x = Instance.new('Explosion', workspace) --Inserting the explosion 
        x.Position = script.Parent.Position --Making the explosion happen exactly where our LandMine is
        script.Parent.Transparency = 1   --Pure aesthetic
        script.Parent.CanCollide = false --For aesthetic...
        wait(Respawn) --Waiting our 10 seconds, change local Respawn however long you want it to be
        script.Parent.Transparency = 0
        script.Parent.CanCollide = true
    debounce = true --Cooldown is over
    end
    end
end)

Just put this code inside of a regular script, and put that script inside of any part and KABOOM!

Hoped this help. If so, please accept my answer!

If you have any questions about the code or more questions in general, just ask!

0
I just realized that it was supposed to go off if someone came near it. You can easily edit the properties of the explosion using x and regardless I'm sure you'd use the .Touched listener for what you're trying to do. StoIid 364 — 8y
Ad

Answer this question