So what I wanna achieve is anything caught in the region that isn’t a human will become rusted and be sent flying forwards and if its a human then they take damage.
the rusting mechanic works fine but for some reason the damage doesn’t work even if im near the explosion, the damage doesn’t work and im not sure whats the problem since the output isn’t showing me what the problem is and im not sure if its a problem because of the region
I tried to use magnitude but that didnt work
my script: (yes im using a module)
function module:createexplosion(position,sizemult,part,volume)
local explosion = Instance.new("Explosion")
explosion.Parent = workspace
explosion.Position = position.Position
explosion.BlastPressure = 0
explosion.DestroyJointRadiusPercent = 0
explosion.BlastRadius = 0
local sound = Instance.new("Sound")
if sound then
sound.Parent = part
sound.SoundId = "rbxassetid://514867425"
sound.Volume = volume or 1
sound.Name = "BOOM"
sound:Play()
sound.Ended:connect(function()
sound:Destroy()
end)
local deb = false
local size = part.CFrame*CFrame.new(0,0,-3).p
local region = Region3.new(size-Vector3.new(3,3,3),size+Vector3.new(3,3,3))
local regtable = workspace:FindPartsInRegion3(region,nil,20)
for i, v in pairs(regtable) do
if v:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(v.Parent) and v ~= part then
if deb == false then
math.ceil(65*math.exp(0.53)/1.566)
v:FindFirstChild("Humanoid"):TakeDamage(math.ceil(65*math.exp(0.53)/1.566))
indicate(math.ceil(65*math.exp(0.53)/1.566),Color3.new(0.985946, 0, 0.0350958),v:FindFirstChild("Torso"))
deb = true
wait(.0015)
deb = false
end
elseif not v:FindFirstChild("Humanoid") then
if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("MeshPart") and v ~= part then
if v and deb == false and v.Size.Y < 18 and v.Size.X < 18 and v.Size.Z < 18 and not game.Players:GetPlayerFromCharacter(v.Parent) then
deb = true
wait(.0015)
deb = false
local origname = v.Name
v.Anchored = false
v.Name = "rusted version of " ..origname
v.Material = Enum.Material.CorrodedMetal
v.BrickColor = BrickColor.new("Brown")
local vel = Instance.new("BodyVelocity",v)
if vel then
vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
vel.Velocity = v.CFrame.lookVector * 75
wait(.015)
vel:Destroy()
end
end
end
end
end
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.