My damage system will not work. Here is my code: (serverside)
local object = game.ReplicatedStorage.Hitbox:Clone()
object.Parent = workspace
object.CFrame = char:FindFirstChild("Wooden Katana").Handle.CFrame
object.Orientation = char:FindFirstChild("Wooden Katana").Handle.Orientation
debris:AddItem(object, .5)
local weld = Instance.new("WeldConstraint")
weld.Parent = object
weld.Part0 = object
weld.Part1 = char:FindFirstChild("Wooden Katana").Handle
local hit = false
object.Touched:Connect(function(part)
print("hello")
if not hit and not part:IsDescendantOf(char) then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid then
hit = true
print("test")
wait()
hit = false
end
end
end)
This is a common problem with using Touched for hitboxes. Remember that Touched only fires when it intersects parts physically. When a hitbox is spawned like this, for whatever reason, it’s not registered as touching against the target character.
When it comes to Touched-based hitboxes, you really have to resort to odd tricks in order for it to function correctly. One such trick is to add a negligible amount of velocity (either via Part.Velocity or a body mover) to an unwelded hitbox and position it such that it’s relatively in the same vicinity as where the weapon can be swung around.
Some other methods I’ve seen don’t involve Touched, but instead look at raycasting and distance-based damage (typically for games where it doesn’t matter if the sword doesn’t actually hit you).
Maybe it’s because of that, the script is only getting the Katana’s CFrame once, and it’s not moving with the Katana (as i think it should work) and since it’s not getting hit by the player, nothing is getting printed.