I’m trying to make multiple blood puddles at once. The only problem is to do so without crashing I need to add wait(), which delays my weapons attacks and sound effects. Is there any way to avoid this?
repeat
local ray = workspace:Raycast(blood.Position, Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)), params)
if ray and cd == false then
--[[ if the ray works ]]--
local function puddle()
--[[ make the puddle ]]--
blood.Sound:Play()
local puddl = game.ReplicatedStorage.BloodPuddle:Clone()
puddl.Parent = game.Workspace
puddl.Color = blood.Color
puddl.CFrame = CFrame.lookAt(ray.Position, ray.Position + ray.Normal) * CFrame.Angles(math.pi/2, 0, 0)
end
if ray.Instance.Anchored == true and ray.Instance.CanCollide == true and ray.Instance.Transparency == 0 then
--[[ if the ray is a terrain part ]]--
puddle()
elseif ray.Instance == game.Workspace.Terrain then
--[[ if the ray is terrain ]]--
puddle()
end
cd = true
end
--[[ end ]]--
until cd == true
until drops == 0