Hey everyone
I’m trying to create my own hitbox system and it works perfectly except for one issue I’ve ran into.
The problem is, if I’m moving or the player is moving, the hitbox doesn’t stay in the same position as it is when im standing still. It moves along with the player and I want to know if there’s a way to fix this?
I’m using the mucachohitbox module for this. Thanks for reading
Also keep in mind I’m a fairly beginner scripter as you can probably tell
game.ReplicatedStorage.Remotes.Hit.OnServerEvent:Connect(function(player, damage)
game.ReplicatedStorage.Remotes.Gui:FireClient(player)
local character = player.Character or player.CharacterAdded:Wait()
local module = require(game.ServerStorage.MuchachoHitbox)
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {character}
local hitboxSize = Vector3.new(4.5, 9, 4)
local hitbox = module.CreateHitbox()
hitbox.Size = hitboxSize
hitbox.CFrame = character.HumanoidRootPart
hitbox.Offset = CFrame.new(0,0,-2.5)
hitbox.Visualizer = true
hitbox.OverlapParams = params
hitbox.Touched:Connect(function(hit, hum)
task.wait(0.13)
hum:TakeDamage(damage)
game.ReplicatedStorage.Remotes.GotHit:FireClient(player, hum)
game.ReplicatedStorage.Remotes.Gui:FireClient(player, hum)
game.ReplicatedStorage.Sounds.Hit:Play()
end)
task.wait(0.13)
hitbox:Start()
game.ReplicatedStorage.Sounds.Swing:Play()
task.wait(0.13)
hitbox:Stop()
end)
This video clip will help to see the problem I’m having
https://streamable.com/tozani