Why are you doing CFrame.new here? You can just do hitplayers.CFrame.
If you want to get the CFrame without the orientation, you can do CFrame.new(hitplayers.Position)
Vector3 is simply a representation of something in 3 axes (typically X,Y,Z). While this could be size, it could also be the position or the orientation!
local module = {}
module.Hitbox = function(player,Cframe,Size, Damage)
local rs = game:GetService("ReplicatedStorage")
local chr = player.Character
local hitboxCFrame = chr.PrimaryPart.CFrame * Cframe
local hitboxSize = Size
local damage = Damage
local hitbox = rs.Hitbox:Clone()
hitbox.Parent = workspace
hitbox.CFrame = hitboxCFrame
hitbox.Size = Vector3.new(hitboxSize, hitboxSize, hitboxSize)
local hitcontent = workspace:GetPartBoundsInBox(hitboxCFrame, hitboxSize)
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= chr and not table.find(hitlist, v.Parent) then
table.insert(hitlist, game:GetService("Players"):GetPlayerFromCharacter(v.Parent))
v.Parent.Humanoid:TakeDamage(damage)
print(v.Parent.Name)
end
end
return hitlist
end
server script
local rs = game:GetService("ReplicatedStorage")
local stunnedevent = rs:WaitForChild("StunnedEvent")
local HitboxModule = require(rs:WaitForChild("Modules").HitboxModule)
stunnedevent.OnServerEvent:Connect(function(player)
local hitplayers = HitboxModule.Hitbox(player,CFrame.new(0,0,-2.5),Vector3.new(5,5,5),10)
local bloodvfx = rs:WaitForChild("M2Vfx"):Clone()
local chr = player.Character
local hrp = chr.PrimaryPart
bloodvfx.Parent = workspace
bloodvfx.CFrame = hitplayers.CFrame
task.wait(0.5)
bloodvfx:Destroy()
end)
@sonic_848 already said it, but to explain it further, you were adding the player to the table, but searching for the character rather than player when you did table.find(hitlist, v.Parent). Inserting v.Parent into the table instead should fix the problem.