Sorry for posting again. Making An rpg is hard. I made a sword that works, but when i added attack boosting by levels it doesnt. there are no errors, can someone help? Non-Attack Boost:
local tool = script.Parent
local debounce = true
tool.Handle.Touched:Connect(function(hit)
local humanoid = hit.Parent.Humanoid
if humanoid and humanoid.Parent ~= tool.Parent then
if debounce == true then
debounce = false
humanoid:TakeDamage(20)
end
end
end)
tool.Activated:Connect(function()
local toolanim = Instance.new("StringValue")
toolanim.Name = "toolanim"
toolanim.Value = "Slash"
toolanim.Parent = tool
debounce = true
end)
with attack boost:
local tool = script.Parent
local player = game.Players:GetPlayerFromCharacter(tool.Parent)
local debounce = true
tool.Handle.Touched:Connect(function(hit)
local humanoid = hit.Parent.Humanoid
if humanoid and humanoid.Parent ~= tool.Parent then
if player then
if debounce == true then
debounce = false
humanoid:TakeDamage(20 * (player.leaderstats.Level.Value +1))
end
end
end
end)
tool.Activated:Connect(function()
local toolanim = Instance.new("StringValue")
toolanim.Name = "toolanim"
toolanim.Value = "Slash"
toolanim.Parent = tool
debounce = true
end)

1 comment
Don't worry about posting alot! We are all here to help each other, feel free to post as much as you'd like!