SO I have a for i, v in ipairs(game.Workspace:GetChildren()) do, and it freezes up the rest of the function. How do I fix this? This is in a server script if you're wondering.
function Shoot()
for i, v in ipairs(game.Workspace:GetChildren()) do
torson = v:WaitForChild("Torso") or v:WaitForChild("HumanoidRootPart")
end
script.Parent.Blast:Play()
local bullet = Instance.new("Part",workspace)
bullet.Size = Vector3.new(0.1,0.5,0.1)
bullet.BrickColor = BrickColor.new("Gold")
bullet.Velocity = myTorso.CFrame.lookVector * 400
bullet.CFrame = CFrame.new(script.Parent.Unit1.Position, torson.Position)
bullet.CanCollide = false
bullet.Touched:Connect(function(obj)
if not obj:IsDescendantOf(script.Parent) then
local human = obj.Parent:FindFirstChild("Humanoid")
if human then
human:TakeDamage(45)
end
bullet:Destroy()
end
end)
game:GetService("Debris"):AddItem(bullet, 5)
end
Thanks in advance!

1 comment
What is "torson" supposed to do?