How could I make other players take damage near one player?

Hi all,

How would I be able to make it so players would take damage around another player?

I’ve attempted attaching parts to a person, and that went as well as you’d expect.

Any help appreciated.

Well, I would use Magnitude and check if any player is in a certain distance of that player.

local dealer = --player which people take damage from
local maxdistance = 16 --distance
local damage = 10 --amount of damage to deal
local interval = 0.75 --interval between damage

while true do
    for i,v in pairs(game.Players:GetPlayers()) do
        if v.Character and dealer.Character and v ~= dealer then
            local dealerhrp = dealer.Character.HumanoidRootPart
            local plrhrp = v.Character.HumanoidRootPar
            if (plrhrp.CFrame.Position - dealerhrp.CFrame.Position).Magnitude <= maxdistance then
                plr.Character.Humanoid:TakeDamage(damage)
            end
        end
    end
    task.wait(interval)
end
1 Like

With some minor changes, it worked! Thanks!

lol, I didn’t test it with studio, so there probably were some errors, but no problem!