basically trying to make a damage over time talent, which is added ontop of normal gun damage but ive tried to get it to stop erroring, because when it does the bullets get stuck on the dummy and just causes hell
local X = 0
local module = {}
module.Yes = function(hit, strings, bullet)
local tool = strings.Parent
local gt = strings.GunType
local BaseGun = require(game:GetService("ReplicatedStorage").Damage:FindFirstChild(gt.Value))
if strings.GunLevel.Value > strings.ReqT2.Value then
local index = math.random(1,5)
if index ~= 3 then
return
end
local C2 = hit.Parent
if not C2 then
return
end
local DmgV = tool.strings.Damage
local gLevel = tool.strings.GunLevel
local character = hit:FindFirstAncestorWhichIsA("Model")
local C = character.HumanoidRootPart
if C:FindFirstChild("Fire") then
return
else
local fire = script.Fire:Clone()
fire.Parent = C
bullet.Transparency = 1
bullet.PointLight.Enabled = false
repeat
if not C2 then
task.cancel()
else
character.Humanoid:TakeDamage((math.round((DmgV.Value * (gLevel.Value/10))*0.2)))
print((math.round((DmgV.Value * (gLevel.Value/10))*0.2)))
X += 1
task.wait(1)
end
until X == 5
X = 0
bullet.Transparency = 0
bullet.PointLight.Enabled = true
fire:Destroy()
end
end
end
return module
the errors only ever come from when i start the repeat