-
What do you want to achieve? Damage only player who is downed (Character) and not tool owner (PlayerCharacter)
-
What is the issue? Everybody around the raycast area “hitbox” gets damaged along with tool owner.
-
What solutions have you tried so far? I’ve heard theres an option with RaycastParms but i’m not sure…
Remotes.Stomp.OnServerEvent:Connect(function()
-- PlayerCharacter is the player stomping/finishing
-- (Basically just tool owner.)
local LocalPlayer = game.Players:GetPlayerFromCharacter(PlayerCharacter)
local Humanoid = PlayerCharacter:FindFirstChildOfClass("Humanoid")
local Animation = Resources.Animations.Finish
local RaycastHitbox = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("RaycastHitboxV4"))
xpcall(function()
local Hitbox = RaycastHitbox.new(Handle) -- Handlie is Tool.Handle (Hitbox area basically)
local Animator = Humanoid:FindFirstChildOfClass("Animator")
Hitbox.OnHit:Connect(function(hit, humanoid)
print(hit.Name)
humanoid:TakeDamage(35)
end)
if Animator then
local AnimtionTrack = Animator:LoadAnimation(Animation)
for _, player in pairs(Players:GetPlayers()) do
if player.UserId == LocalPlayer.UserId then
continue
end
-- "Character" is the player dying/finished.
local Character = player.Character
local CharPlayer = game.Players:GetPlayerFromCharacter(Character)
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local OtherHumanoid = Character:FindFirstChildOfClass("Humanoid")
local content = game.Players:GetUserThumbnailAsync(CharPlayer.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
if Character:FindFirstChild("Values").Ragdolled.Value == true and OtherHumanoid.Health >= 1 then
-- Making sure Character (player getting stomped/downed)
-- is near the tool owner (PlayerCharacter)
local Distance = (HumanoidRootPart.Position - PlayerCharacter.PrimaryPart.Position).Magnitude
if Distance < 7.5 then
Humanoid.WalkSpeed = 1
AnimtionTrack:Play()
Hitbox:HitStart()
task.wait(2)
-- Once again Character is the player taking damage NOT PlayerCharacter
-- (PlayerCharacter is the owner of the tool and player who fired the event.)
Humanoid.WalkSpeed = 16
task.wait(0.2)
Hitbox:HitStop()
-- "Character" player who got stomped is "dead".
if OtherHumanoid.Health <= 0 then
killedevent:FireClient(LocalPlayer, CharPlayer.Name, 25, content)
-- Owner of tool is awarded
LocalPlayer.leaderstats.TIX.Value += 25
LocalPlayer.Stats.KillStreak.Value += 1
-- end
end
end
end
end
end
end, warn)
end)