im not really asking for scripts but if you could tell me how to make a script so then i can step on a landmine but instead of the explosion visuals i get the particle explosion that i have working but still have the power of the explosion to fling me and kill me
COMMUNITY QUESTION
Explosion but without the explosion?
1 answer
I am not so confident with what I came up, but I will share it anyways.
Step1. Go through every player close to that landmine when someone steps on it, and return the magnitude like this:
local Players = game:GetService("Players")
local function explode(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
for i,v in pairs(Players:GetPlayers()) do
if v.Characer then
local humRoot = v.Character:FindFirstChild("HumanoidRootPart")
if humRoot then
local distance = (script.Parent.Position - humRoot.Position).magnitude
end
end
end
end
script.Parent.Touched:Connect(explode)
Step2. Determine whether to kill player, by comparing the distance to the value of how close the player should be to get killed. and if not kill, fling the character by using the body force.
local Players = game:GetService("Players")
local maxDist = 100
local killDist = 20
local function explode(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
for i,v in pairs(Players:GetPlayers()) do
if v.Character then
local character = v.Character
local humRoot = v.Character:FindFirstChild("HumanoidRootPart")
if humRoot then
local distance = (script.Parent.Position - humRoot.Position).magnitude
local Humanoid = character:FindFirstChild("Humanoid")
if distance < killDist then
--Kills player
if Humanoid then
Humanoid:TakeDamage(100--[[Damage Player]])
end
elseif distance < maxDist then
--won't kill, but will fling
local BF = Instance.new("BodyForce")
BF.Force = Vector3.new(math.random(-1000,1000),10000,math.random(-1000,1000)) --Flings in random direction
Humanoid.Sit = true
BF.Parent = humRoot
game:GetService("Debris"):addItem(BF,.1)
end
end
end
end
end
script.Parent.Touched:Connect(explode)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
explosion.BlastPressure!
oHhhhhhhhhhh ok thank you