Damage Script
Customize your variables, then fill in the blanks!
Your Custom Settings
Damage per hit
Name in ReplicatedStorage
Part attached to character
Script (ServerScriptService)
This script creates a damage zone on each player and handles the damage when they hit opponents. Create a RemoteEvent in ReplicatedStorage!
local Players = game:("Players")
local damageEvent = game.:("DamageEvent")
Players.:Connect(function(player)
player.:Connect(function(character)
local hrp = character:WaitForChild("HumanoidRootPart")
local detectZone = .new("Part")
detectZone.Name = "detectZone"
detectZone.Size = Vector3.new(4, 4, 4)
detectZone. = 1
detectZone.CanCollide = false
detectZone.Parent = character
local weld = Instance.new("")
weld.Part0 = hrp
weld.Part1 = detectZone
weld.Parent = detectZone
end)
end)
damageEvent.:Connect(function(attacker, victim)
local humanoid = victim:FindFirstChild("Humanoid")
if humanoid then
humanoid:(5)
end
end)
