local WS = game:GetService("Workspace")
local RUN= game:GetService("RunService")
local RUNconn
local Sword = script.Parent
local Character = Sword.Parent
local Hitbox = Sword.Hitbox
local RemDmg = Sword.RemoteDamage
local Params = OverlapParams.new()
Params.FilterType = Enum.RaycastFilterType.Exclude
Params.FilterDescendantsInstances = {Character}
Params.CollisionGroup = "Damager"
Params.RespectCanCollide = false
local HitList = {}
RemDmg.OnServerEvent:Connect(function(_,bool)
if bool == "true" then
table.clear(HitList)
if RUNconn then RUNconn:Disconnect() RUNconn = nil end
RUNconn = RUN.Heartbeat:Connect(function()
local Parts = WS:GetPartsInPart(Hitbox,Params)
if #Parts == 0 then return end
for _, p in Parts do
local Hum = p.Parent:FindFirstChildOfClass("Humanoid")
print(p)
if Hum and not HitList[Hum] then
HitList[Hum] = true
Hum:TakeDamage(20)
end
end
end)
elseif bool == "false" and RUNconn then
RUNconn:Disconnect()
RUNconn = nil
table.clear(HitList)
end
end)
Thats the ServerScript in the Sword-Tool which lays in StarterPack
** You are now Level 4! **