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 it so my humanoid dont die, i believe its the welding
- What is the issue? Include screenshots / videos if possible!
the problem starts at "if Ability == “AB2”.
local Remotes = script.Parent.Remotes
local Animations = script.Parent.Animations
local Sounds = script.Parent.Sounds
local RS = game:GetService("ReplicatedStorage")
local Modules = RS.Modules
local AnimModule = require(Modules.AnimationPlayer)
local SoundModule = require(Modules.SoundPlayer)
local HitboxModule = require(Modules.Hitbox)
local DamageModule = require(Modules.Damage)
local LMBCount = 1
Remotes.CombatEvent.OnServerEvent:Connect(function(plr, Ability)
local char = plr.Character
local hum = char:FindFirstChild("Humanoid")
local HRP = char:FindFirstChild("HumanoidRootPart")
if Ability == "LMB" then
SoundModule:Play(HRP, Sounds.LMB, 1)
local Hitbox = HitboxModule.new()
Hitbox.CFrame = HRP.CFrame
Hitbox.Size = Vector3.new(6, 3, 7)
Hitbox.Offset = CFrame.new(0, 0, -4)
Hitbox.onTouch = function(TargetHum)
if TargetHum ~= hum then
SoundModule:Play(TargetHum.Parent:FindFirstChild("HumanoidRootPart"), Sounds.Hit, 1)
DamageModule:Damage(TargetHum, hum, "Normal", 10)
end
end
task.spawn(function()
for i = 1, 5 do
Hitbox:Start()
task.wait(0.025)
Hitbox:Stop()
Hitbox.CFrame = HRP.CFrame
task.wait(0.001)
end
end)
Remotes.CombatEvent:FireClient(plr, "LMB")
task.spawn(function()
if LMBCount == 1 then
AnimModule:Animation(hum, Animations.Lmb1):Play(0)
AnimModule:Animation(hum, Animations.Lmb2):Stop(0)
LMBCount += 1
elseif LMBCount == 2 then
AnimModule:Animation(hum, Animations.Lmb2):Play(0)
AnimModule:Animation(hum, Animations.Lmb1):Stop(0)
LMBCount = 1
end
end)
end
if Ability == "AB2" then
task.spawn(function()
local Anim
Anim = AnimModule:Animation(hum, Animations.AB2)
Anim:Play(0)
Anim:GetMarkerReachedSignal("Grab"):Connect(function()
local Hitbox = HitboxModule.new()
Hitbox.CFrame = HRP.CFrame
Hitbox.Size = Vector3.new(12, 3, 12)
Hitbox.onTouch = function(TargetHum)
if TargetHum ~= hum and (HRP.Position - TargetHum.Parent:FindFirstChild("HumanoidRootPart").Position).Magnitude <= 5 then
local GrabAnim, GrabbedAnim
Anim:Stop(0)
GrabAnim = AnimModule:Animation(hum, Animations.AB2Grab)
GrabbedAnim = AnimModule:Animation(TargetHum, Animations.AB2Grabbed)
local Weld = Instance.new("Motor6D")
Weld.Parent = HRP
Weld.Part1 = HRP
Weld.Part0 = TargetHum.Parent:FindFirstChild("HumanoidRootPart")
Weld.C0 = CFrame.new(0.046, -0.05, -3.046) * CFrame.Angles(math.rad(0), math.rad(180), math.rad(0))
--HRP.Anchored = true
--TargetHum.Parent:FindFirstChild("HumanoidRootPart").Anchored = true
GrabbedAnim:Play(0)
GrabAnim:Play(0)
DamageModule:Damage(TargetHum, hum, "Normal", 10)
GrabAnim:GetMarkerReachedSignal("Attack"):Connect(function()
DamageModule:Damage(TargetHum, hum, "Normal", 4)
end)
GrabAnim:GetMarkerReachedSignal("End"):Connect(function()
DamageModule:Damage(TargetHum, hum, "Normal", 7)
Weld:Destroy()
end)
elseif TargetHum ~= hum then
DamageModule:Damage(TargetHum, hum, "Normal", 7.5)
end
end
Hitbox:Start()
task.wait(0.025)
Hitbox:Stop()
end)
end)
end
end)