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!
Somehow the hitbox in the server script kills the target instantly, i do not want that to happen, i just want them to be knocked back and ragdolled*** -
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I tried looking it up, but i just dont know how it happens, so I came here if anyone knows about it
The Hitbox Script
M1Event.OnServerEvent:Connect(function(player,Type)
local character = player.Character
if character:GetAttribute("Stunned") then return end
local HRP : BasePart = character:FindFirstChild("HumanoidRootPart")
local humanoid = character:FindFirstChildOfClass("Humanoid")
local Animator = humanoid:FindFirstChildOfClass("Animator")
local uppercutTrack
if Type == "Fast" then
local randomTrack = Anims[math.random(1,#Anims)]
uppercutTrack = Animator:LoadAnimation(randomTrack)
else
uppercutTrack = Animator:LoadAnimation(Mahoraga.Uppercut)
end
uppercutTrack.Priority = Enum.AnimationPriority.Action2
uppercutTrack:Play()
local Swing = script.Swing:Clone()
Swing.Parent = Mahoraga.PrimaryPart
Swing:Play()
game.Debris:AddItem(Swing,Swing.TimeLength)
local Hitbox = Utilities:CreateHitbox(HRP,{Size = Vector3.new(9,9,9),Time = 0.5})
local db = {}
table.clear(db)
Hitbox.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
if hum then
if table.find(db,hit.Parent) then return end
table.insert(db,hit.Parent)
local targetRoot = hit.Parent:FindFirstChild("HumanoidRootPart")
local targetPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
Effect:Ring(targetRoot.CFrame)
Effect:Ring(targetRoot.CFrame,Vector3.new(20,0.4,20))
Effect:Glow(hit.Parent,Color3.fromRGB(134, 134, 134),0.1)
if Type == "Fast" then
Glove:Slash(Mahoraga.Owner,hit.Parent,HRP.CFrame.LookVector * 7,1,5)
local Slice = script.Slice:Clone()
Slice.Parent = Mahoraga.PrimaryPart
Slice:Play()
game.Debris:AddItem(Slice,Slice.TimeLength)
elseif Type == "Medium" then
Events.CustomShake:FireClient(player,1,1,0,1)
Glove:Slash(Mahoraga.Owner,hit.Parent,HRP.CFrame.LookVector * 15 + Vector3.new(0,5,0),2,5)
local PunchMed = script.PunchMed:Clone()
PunchMed.Parent = Mahoraga.PrimaryPart
PunchMed:Play()
game.Debris:AddItem(PunchMed,PunchMed.TimeLength)
local Slice = script.Slice:Clone()
Slice.Parent = Mahoraga.PrimaryPart
Slice:Play()
game.Debris:AddItem(Slice,Slice.TimeLength)
elseif Type == "Heavy" then
Events.CustomShake:FireClient(player,4,4,0,1)
if targetPlayer then
Events.CustomShake:FireClient(player,4,4,0,1)
end
Glove:Slash(Mahoraga.Owner,hit.Parent,HRP.CFrame.LookVector * 30 + Vector3.new(0,15,0),3,5)
local PunchHeavy = script.PunchHeavy:Clone()
PunchHeavy.Parent = Mahoraga.PrimaryPart
PunchHeavy:Play()
game.Debris:AddItem(PunchHeavy,PunchHeavy.TimeLength)
local Slice = script.Slice:Clone()
Slice.Parent = Mahoraga.PrimaryPart
Slice:Play()
game.Debris:AddItem(Slice,Slice.TimeLength)
end
end
end)
end)
The Module That’s Being used While Ragdolling
function GloveModule:Slash(own,target : Model,velocity,RTG,Power)
local Invincible = target:GetAttribute("Invincible")
local Bruised = target:GetAttribute("Bruised")
local Endurance = target:GetAttribute("Endurance")
local Reflection = target:GetAttribute("Reflection")
local RagdollMult = (Glove and Glove.RagdollMultiplier and Glove.RagdollMultiplier.Value) or 1
local KnockbackMult = (Glove and Glove.KnockbackMultiplier and Glove.KnockbackMultiplier.Value) or 1
local AngularMult = (Glove and Glove.AngularMultiplier and Glove.AngularMultiplier.Value) or 1
local RagdollResistance = target:GetAttribute("RagdollResistance")
local Player : Player = Players:FindFirstChild(own.Value)
local targetPlayer : Player = Players:FindFirstChild(target.Name)
if targetPlayer and targetPlayer.Neutral == false then
if Player.TeamColor == targetPlayer.TeamColor then
print(Player.Name.." is on the same team with "..targetPlayer.Name)
return
end
end
if RagdollResistance then
RTG = RTG - RagdollResistance
end
RTG = RTG * RagdollMult
if Invincible then
print(target.Name.." is invincible")
return
end
if target == Player.Character or (targetPlayer and targetPlayer == Player) then
print(target.Name.." is same target")
return
end
local targetHumanoid = target:FindFirstChildOfClass("Humanoid")
local targetHRP = target:FindFirstChild("HumanoidRootPart")
if not targetHumanoid or not targetHRP then
print("no humanoid or root")
return
end
local flingvelocity = velocity * 5
local spinvelocity = velocity * 0.5
if Reflection then
local bv = Instance.new("BodyVelocity")
bv.Parent = Player.Character:WaitForChild("HumanoidRootPart")
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
local velocity = -flingvelocity + Vector3.new(0, Power + 10, 0) * KnockbackMult
if Bruised and Bruised > 0 then
velocity += velocity.Unit * Bruised
end
if Endurance and Endurance > 0 then
velocity -= velocity.Unit * Endurance
end
bv.Velocity = velocity
local bav = Instance.new("BodyAngularVelocity")
bav.Parent = Player.Character:WaitForChild("HumanoidRootPart")
bav.AngularVelocity = flingvelocity + Vector3.new(0,Power,0) * AngularMult
game.Debris:AddItem(bv,0.3)
game.Debris:AddItem(bav,0.2)
local CharRagdoll = Ragdoll.new(Player.Character, {
CollisionsEnabled = true,
RagdollType = "Toggle",
RemovalTime = RTG
})
task.spawn(function()
CharRagdoll:doRagdoll(true)
task.wait(RTG)
CharRagdoll:doRagdoll(false)
end)
local value = Instance.new("BoolValue")
value.Name = "SLAPPED"
value.Value = true
value.Parent = target
task.delay(RTG,function()
wait(RTG)
value:Destroy()
end)
return
end
local leaderstats = Player:FindFirstChild("leaderstats")
local Slaps = leaderstats:FindFirstChild("Slaps")
if Slaps then
Slaps.Value += 1
end
local CharRagdoll = Ragdoll.new(target, {
CollisionsEnabled = true,
RagdollType = "Toggle",
RemovalTime = RTG
})
task.spawn(function()
CharRagdoll:doRagdoll(true)
task.wait(RTG)
CharRagdoll:doRagdoll(false)
end)
local TargetHRP = target:FindFirstChild("HumanoidRootPart")
local bv = Instance.new("BodyVelocity")
bv.Parent = target:WaitForChild("HumanoidRootPart")
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
local velocity = flingvelocity + Vector3.new(0, Power + 10, 0) * KnockbackMult
if Bruised and Bruised > 0 then
velocity += velocity.Unit * Bruised
end
if Endurance and Endurance > 0 then
velocity -= velocity.Unit * Endurance
end
bv.Velocity = velocity
local bav = Instance.new("BodyAngularVelocity")
bav.Parent = target:WaitForChild("HumanoidRootPart")
bav.AngularVelocity = flingvelocity + Vector3.new(0,Power,0) * AngularMult
target.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
local value = Instance.new("BoolValue")
value.Name = "SLAPPED"
value.Value = true
value.Parent = target
game.Debris:AddItem(bv,0.3)
game.Debris:AddItem(bav,0.2)
task.delay(RTG,function()
wait(RTG)
value:Destroy()
end)
end
Sorry for no comments, im just like that ![]()
Also, I think this happens because of this maybe, It switches the player’s character, this doesn’t happen with other scripts that use this module, it may be an issue with the character
Events.SetCamera:FireClient(player,Mahoraga.Humanoid)
player.Character = Mahoraga
Mahoraga.Owner.Value = player.Name
Mahoraga.CameraOffset.Enabled = true
Mahoraga.Animate.Enabled = true
Mahoraga.Ability.Enabled = true
Mahoraga.RagdollScript.Enabled = true
Mahoraga.Highlight:Destroy()
The Issue:
For some reason, i tried it many times, this issue doesnt happen with non-player characters: