TakeDamage Alternitive

  1. What do you want to achieve? A working sword

  2. What is the issue? I need an alternative besides takedamage

3.What solutions have you tried so far? Devhub Devforum youtube and tweaking the code

I was making a sword but it wouldn’t work because takedamage doesn’t work on players due to players having ForceField | Roblox Creator Documentation I need help to fix the code please thank you.

local tool = script.Parent

local function onTouch(partOther)
local humanOther = partOther.Parent:FindFirstChild(“Humanoid”)
if not humanOther then return end
if humanOther.Parent == tool then return end
humanOther:takedamage(10)
end

local function slash()

local str = Instance.new("StringValue")
str.Name = "toolanim"
str.Value = "Slash"
str.Parent = tool

end

tool.Activated:Connect(slash)
tool.Handle.Touched:Connect(onTouch)

Is ForceField meant to be there? Do you want to remove ForceField every time a player (re)spawns?

1 Like

Alternative:

--checking
if (Humanoid.Health <= 0) then return end

Humanoid.Health = Humanoid.Health - yourDamage
--or even
Humanoid.Health -= yourDamage
2 Likes

Idc about the force field I just want something that can penatrate through it.