Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

1 comment

0

I'm unsure what you are on about.

1 answer

✓ Accepted answer

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!

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.