-
What do you want to achieve? A working sword
-
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)