I spent nearly all day on this.
https://gyazo.com/bcc29bca56773c054b5e65c44f590e0a
What it’s doing is that it’s tracking the player, and it’s supposed to fire if the player is in range, which they are.
What it’s not doing is it’s not firing more than once.
I am very puzzled by this.
local WeaponProperties = {
['Damage'] = 1,
['FireRate'] = 0,
['Speed'] = 1000,
['Distance'] = 100,
}
local A3 = nil
local A1 = nil
local bool = true
local Base = script.Parent.Base
while wait(WeaponProperties.FireRate) do
local fol
if not workspace:FindFirstChild(script.Parent.Placer.Value..'AAViperDebris') then
local b = Instance.new("Folder")
b.Name = script.Parent.Placer.Value..'AAViperDebris'
b.Parent = workspace
fol = b
end
for _,_Q1 in pairs(workspace:GetChildren()) do
local A2 = _Q1:FindFirstChild('Humanoid')
if A2 then
if (A2.Parent['HumanoidRootPart'].Position - Base.Parent.H.Position).magnitude < WeaponProperties.Distance then
A1 = A2.Parent['HumanoidRootPart']
bool = false
else
A1 = nil
end
end
end
if A1 ~= nil then
local Person = A1.Parent['HumanoidRootPart']
Base.CFrame = CFrame.new(Base.Position, Person.Position)
local Decision = math.random(1,2)
local fuse = 'Arm'..Decision
local Bullet = Base[fuse].ViperBullet:Clone()
Bullet.Parent = fol
Bullet.Transparency = 0
Bullet.c:Destroy()
Bullet.Velocity = Base.CFrame.LookVector * WeaponProperties.Speed
Bullet.Touched:connect(function(part)
if game.Players:FindFirstChild(part.Parent.Name) then
part.Parent['Humanoid']:TakeDamage(WeaponProperties.Damage)
end
end)
else
print('Waiting.')
end
end
I don’t think there is a solution to this in my POV. I don’t see any clear issue with this, because it’s supposed to clone the bullet and whatever.
But it’s only doing it once…
Suggestions and Solutions will be helpful.