Hello, Im trying to make a turret shoot, but for some reason it is not working.
Script:
event.OnServerEvent:Connect(function(plr, turnon)
print("Event received")
if turnon == true then
print("Turnon true")
firing = true
while wait(0.5) do
print("Loop")
if firing == true then
print("Gonna shoot")
local bullet = script.Parent.AmericanAABullet
local new = bullet:Clone()
new.Anchored = false
new.Position = script.Parent.BulletSpawn.Position
new.Velocity = script.Parent.BulletSpawn.CFrame.LookVector * 100
new.Parent = script.Parent.Bullets
else
break
end
end
elseif turnon == false then
firing = false
end
end)
Everything prints, but the bullet doesn’t even clone.