Unable to cast double to Vector3

Hi im trying to make a hitbox system unfortunately im gettting an error
resources online don’t seem to help my case
image

local uis = game:GetService("UserInputService")
local rs = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer
local chr = player.Character
local hum = chr:WaitForChild("Humanoid")
local ListOfWeapons = {
	"BasicSword",
	"RengokuSword",
	"PlaceHolder1",
}

local module = require(rs:WaitForChild("Modules").CombatSystemModule)
local CombatNum = 1
local debounce = false
uis.InputBegan:Connect(function(input,e)
	if e then return end

	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		for i,v in player.Character:GetChildren() do
			if table.find(ListOfWeapons, v.Name) and v:IsA("MeshPart") and debounce == false then
				debounce = true-- assuming this is the problem, as it may of let other MeshParts through
				module.CombatSystem(player, CombatNum)
				CombatNum += 1

				if CombatNum > 4 then
					CombatNum = 1
				end
				local hitboxCFrame = chr.HumanoidRootPart.CFrame * CFrame.new(0,0,-2.5)
				local hitboxSize = 5
				local damage = 10
				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, v.Parent)
						v.Parent.Humanoid:TakeDamage(damage)
					end
				end
				----for i,v in pairs(hitlist) do
				----	print(v.Name)
				----	if v:FindFirstChild("Blocking") then
				----		v:FindFirstChild("Blocking"):Destroy()
				----	end
				--end
				
			   task.wait(0.5)
			   debounce = false
				return
			end
		end
	end
end)

hitbox size needs to be a vector3 not number.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.