I'm making a script so when you press q, your character does an animation and a death bubble appears around him. If the bubble collides with another player's bubble or any other object that isn't anchored (Other than the drooling zombies i'm testing it out on), it stops the death script and won't kill the people anymore. Here is the code, it is a local script inside my tool:
local tool = script.Parent
local health = false
local debounce = false
local character = game:GetService('Players').LocalPlayer
local player = character.Character or character.CharacterAdded:wait()
tool.Equipped:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "q" and debounce == false then
debounce = true
print("ForceField")
local ForceField = Instance.new("Part", player)
ForceField.BrickColor = BrickColor.new("Deep blue")
ForceField.Transparency = 0.7
ForceField.CanCollide = false
ForceField.Anchored = true
ForceField.Shape = Enum.PartType.Ball
ForceField.Size = Vector3.new(25,25,25)
ForceField.BottomSurface = Enum.SurfaceType.Smooth
ForceField.TopSurface = Enum.SurfaceType.Smooth
ForceField.CFrame = CFrame.new(player.Torso.Position + Vector3.new(0,0,0))
ForceField.Parent = game.Workspace
ForceField.Touched:connect(function(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if not hit:IsDescendantOf(player) and health == false then
health = true
humanoid.Health = humanoid.Health -3
print ("DEATH TO THE HOOOOMANNSSSS")
health = false
else
print("Hi Me ;)")
end
end)
wait(2)
ForceField:remove()
debounce = false
end
end)
end)
If I hit anything that bascially doesn't have a"humanoid.Health" value, then it stops printing ("DEATH TO THE HOOOOMANNSSSS") and idk why ;-;, please help.
