You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to create a hitbox when marker “Hit” is reached on the animation but when i do any other function is off -
What is the issue? Include screenshots / videos if possible!
I’m really confused and i don’t know how to do this -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried for a long time but nothing helped
RepStorage.Punch.OnServerEvent:Connect(function(Player, Punch)
-- Player Information
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local RootPart = Character:WaitForChild("HumanoidRootPart")
-- Animator Function
local PunchTrack = Animator:LoadAnimation(script[Punch])
PunchTrack:Play()
--
PunchTrack:GetMarkerReachedSignal("Hit"):Connect(function()
local Params = OverlapParams.new()
Params.FilterType = Enum.RaycastFilterType.Exclude
Params.FilterDescendantsInstances = {Player.Character:GetChildren()}
local HitBox = HitBoxModule.CreateHitbox()
HitBox.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -5)
HitBox.Size = Vector3.new(5,5,5)
HitBox.DetectionMode = "HitOnce"
HitBox.OverlapParams = Params
end)
-- Functions
HitBox.Touched:Connect(function(Hit, Hum)
warn(Hit)
Hum:TakeDamage(15)
end)
PunchTrack.Stopped:Connect(function()
HitBox:Stop()
end)
HitBox:Start()
end)
Help please