Can’t One Shot a Dummy With a Sword

Hi,

So the problem that I am facing is that I can’t one shot a dummy when I deal 100 or more damage. However, I can kill the dummy if I two shot him for example :99dmg + 99dmg and I want the dummy to be anchored. I believe that the problem is with my sword damage script but I can’t seem to find it.



Here is the sword damage script:

local DebonceTable = {}
local debounce = false

script.Parent.Activated:Connect(function()
	if debounce == false then
		debounce = true
		local connection
		connection = script.Parent:WaitForChild("Hitbox").Touched:Connect(function(hit)
			if hit.Parent then
				if hit.Parent:FindFirstChild("Humanoid") then
					if game.Players:GetPlayerFromCharacter(hit.Parent) == nil then
						if DebonceTable[hit.Parent] == true then return end
						task.spawn(function()
							hit.Parent.Humanoid:TakeDamage(script.Parent.Damage.Value)
							wait(0.5)
							debounce = false
						end)
						connection:Disconnect()
					end
				end
			end
		end)
	end
end)

It is probably one shot, but the NPC is most likely anchored

If you want to keep it anchored I have this code that should kind of work, by making the parts still fall if the damage doesn’t go over 100 and it hit after hit:

local hum = script.Parent.Humanoid
local recentHealth = 100
local health

while true do 
	wait(0.001)
	health = hum.Health
	if health < recentHealth then
		script.Parent.HumanoidRootPart.Anchored = false
	else
		script.Parent.HumanoidRootPart.Anchored = true
	end
	recentHealth = hum.Health
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.