You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I am trying to make a script that shoots lightning out of the player’s hand at does damage to a humanoid.
-
What is the issue? On moving humanoids such as the drolling zombie the ontouched event is firing while on things like still other players or dummies it is now.
-
What solutions have you tried so far? I have tried changing the hitbox length the hit the different parts of the humanoid
My hitbox code:
Hitbox.Touched:Connect(function(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
if hit.Parent.Name ~= Character.Name then
local NewCharacter = hit.Parent
if Hitppl[Player.Name] then return end
Hitppl[Character.Name] = true
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://5380859448"
local LoadAnimation = NewCharacter.Humanoid:LoadAnimation(Animation)
LoadAnimation:Play()
local BodPos = Instance.new("BodyPosition")
BodPos.MaxForce = Vector3.new(5000000, 5000000, 5000000)
BodPos.P = 50000
BodPos.Position = NewCharacter:FindFirstChild("HumanoidRootPart").Position
BodPos.Parent = NewCharacter:FindFirstChild("HumanoidRootPart")
NewCharacter:FindFirstChild("Humanoid"):TakeDamage(DAMAGE)
wait(0.1)
if hit.Parent:FindFirstChild("Humanoid") then
game.Debris:AddItem(BodPos,.1)
else
game.Debris:AddItem(BodPos,.2)
end
end
end)