You can write your topic however you want, but you need to answer these questions:
Im trying to make the hitbox moves with my player. I’ve already tried welding but my characters just get stucks in place.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Replicate = ReplicatedStorage.Remotes.Slashes
local Hitfx = ReplicatedStorage.Assests.Effects.HitFX
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local soundmodule = require(game.ReplicatedStorage.Modules.SoundModule)
local SlashFX1 = ReplicatedStorage.Assests.Effects.Slash1:Clone()
local SlashFX2 = ReplicatedStorage.Assests.Effects.Slash2:Clone()
local SlashFX3 = ReplicatedStorage.Assests.Effects.Slash3:Clone()
local FX = workspace.FX
local Live = workspace.World.Live
Replicate.OnServerEvent:Connect(function(Player)
local plrCharacter = Player.Character
local Humanoid = plrCharacter:FindFirstChild("Humanoid")
local HumanoidRootPart = plrCharacter:FindFirstChild("HumanoidRootPart")
local function hitbox()
local hitbox1 = Instance.new("Part")
hitbox1.Size = Vector3.new(5, 3, 5)
hitbox1.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
hitbox1.CanCollide = false
hitbox1.Transparency = 0
hitbox1.Anchored = true
hitbox1.Name = "Hitbox1"
hitbox1.Parent = workspace.FX
hitbox1.Massless = true
local weld = Instance.new("WeldConstraint")
weld.Part0 = hitbox1
weld.Part1 = HumanoidRootPart
weld.Parent = hitbox1
HumanoidRootPart.Anchored = false
local params = OverlapParams.new()
params.FilterDescendantsInstances = {plrCharacter}
params.FilterType = Enum.RaycastFilterType.Exclude
local Size = Vector3.new(3, 4, 5)
local PartsTable = workspace:GetPartsInPart(hitbox1, params)
local DebounceTable = {}
for Index, Part in PartsTable do
if Part.Parent:FindFirstChild("Humanoid") and not table.find(DebounceTable, Part.Parent) then
table.insert(DebounceTable, Part.Parent)
local hit1 = Part.Parent.Humanoid:LoadAnimation(ReplicatedStorage.Assests.Animations.Hit1)
local Hitfx = ReplicatedStorage.Assests.Effects.HitFX:Clone()
hit1:Play()
local Character = Part.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
Humanoid:TakeDamage(7)
end
end
table.clear(DebounceTable)
task.delay(.9, hitbox1.Destroy, hitbox1)
end
local function hitbox2()
local hitbox2 = Instance.new("Part")
hitbox2.Size = Vector3.new(5, 3, 5)
hitbox2.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
hitbox2.CanCollide = false
hitbox2.Transparency = 0
hitbox2.Anchored = true
hitbox2.Name = "Hitbox1"
hitbox2.Parent = workspace.FX
local params = OverlapParams.new()
params.FilterDescendantsInstances = {plrCharacter}
params.FilterType = Enum.RaycastFilterType.Exclude
local Size = Vector3.new(3, 4, 5)
local PartsTable = workspace:GetPartsInPart(hitbox2, params)
local DebounceTable = {}
for Index, Part in PartsTable do
if Part.Parent:FindFirstChild("Humanoid") and not table.find(DebounceTable, Part.Parent) then
table.insert(DebounceTable, Part.Parent)
local hit2 = Part.Parent.Humanoid:LoadAnimation(ReplicatedStorage.Assests.Animations.Hit2)
local Hitfx = ReplicatedStorage.Assests.Effects.HitFX:Clone()
task.wait(.3)
hit2:Play()
local Character = Part.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
Humanoid:TakeDamage(7)
end
end
table.clear(DebounceTable)
task.delay(.9, hitbox2.Destroy, hitbox2)
end
local function hitbox3()
local hitbox3 = Instance.new("Part")
hitbox3.Size = Vector3.new(5, 3, 5)
hitbox3.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
hitbox3.CanCollide = false
hitbox3.Transparency = 0
hitbox3.Anchored = true
hitbox3.Name = "Hitbox1"
hitbox3.Parent = workspace.FX
local params = OverlapParams.new()
params.FilterDescendantsInstances = {plrCharacter}
params.FilterType = Enum.RaycastFilterType.Exclude
local Size = Vector3.new(3, 4, 5)
local PartsTable = workspace:GetPartsInPart(hitbox3, params)
local DebounceTable = {}
for Index, Part in PartsTable do
if Part.Parent:FindFirstChild("Humanoid") and not table.find(DebounceTable, Part.Parent) then
table.insert(DebounceTable, Part.Parent)
local hit3 = Part.Parent.Humanoid:LoadAnimation(ReplicatedStorage.Assests.Animations.Hit3)
local Hitfx = ReplicatedStorage.Assests.Effects.HitFX:Clone()
task.wait(.3)
hit3:Play()
local Character = Part.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
Humanoid:TakeDamage(8)
end
end
table.clear(DebounceTable)
task.delay(.9, hitbox3.Destroy, hitbox3)
end
task.wait(.1)
hitbox()
task.wait(.2)
hitbox2()
task.wait(.2)
hitbox3()
task.wait(3)
SlashFX1:Destroy()
SlashFX2:Destroy()
SlashFX3:Destroy()
end)