I just want advice/tips on how I should add damage to my sword/melee combat.
I was planning to add like the lava bricks to the sword’s blade but I dont think it will work and also the animation might make it kill you instead.
thx
I just want advice/tips on how I should add damage to my sword/melee combat.
I was planning to add like the lava bricks to the sword’s blade but I dont think it will work and also the animation might make it kill you instead.
thx
Get the script from the oringal ROBLOX sword, and kinda fix it.
@Forummer just gave a great script which helped me out a lot. Simply create a part named “blade” which will act as your hitbox. I assume you know how to weld parts already.
here is the script:
local tool = script.Parent
local blade = tool:WaitForChild("Handle") --change name if necessary
local swingConn
local debounce = false
tool.Activated:Connect(function()
swingConn = blade.Touched:Connect(function(hit)
if debounce then
return
end
local enemyHum = hit.Parent:FindFirstChild("Humanoid")
if enemyHum then
debounce = true
enemyHum:TakeDamage(10) --damage, change damage if necessary
end
task.wait(0.5) --cooldown, change if necessary
debounce = false
end)
end)
tool.Deactivated:Connect(function()
if swingConn then
swingConn:Disconnect()
end
end)
the script goes inside the tool
also heres a script which will play animations with your tool (not sure if you already have a script) but this is the system im using along with the previous script i replied with.
wait(3)
Player = game.Players.LocalPlayer.Character
Animation1 = Player.Humanoid:LoadAnimation(script.Slices)
Animation2 = Player.Humanoid:LoadAnimation(script.Spin)
Animation3 = Player.Humanoid:LoadAnimation(script.BackFlipStab)
Animation4 = Player.Humanoid:LoadAnimation(script.DownSlice)
CanFly = true
script.Parent.Parent.Activated:connect(function()
local Fly = math.random(1,5)
if Fly == 1 and CanFly == true then
Animation1:Play()
CanFly = false
wait(1.35)
CanFly = true
else if Fly == 2 and CanFly == true then
Animation2:Play()
CanFly = false
wait(1.35)
CanFly = true
else if Fly == 3 and CanFly == true then
Animation3:Play()
CanFly = false
wait(0.7)
CanFly = true
else if Fly == 4 and CanFly == true then
Animation4:Play()
CanFly = false
wait(0.7)
CanFly = true
end
end
end
end
end)