You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
To delete iS without making the script wait before making another iS -
What is the issue? Include screenshots / videos if possible!
iS 1 doesent delete when instance:Destroy() is used - What solutions have you tried so far? Did you look for solutions on the Developer Hub?
local ts = game:GetService("TweenService")
local rs = game:GetService("ReplicatedStorage")
local CAP = require(game.ServerScriptService:FindFirstChild("Clear_ATTACK"))
game.ReplicatedStorage.iceAttack2.OnServerEvent:Connect(function(player, pos)
local ti = TweenInfo.new(
0.75,
Enum.EasingStyle.Back,
Enum.EasingDirection.In,
0,
true
)
local goals = {
Position = pos + Vector3.new(0, 2.5, 0)
}
local num = math.random(5, 10)
local iceSpike = rs:FindFirstChild("IceSpike")
local stop = 0
local table = {}
while num > -1 do
local number1 = math.random(10, 20)
local number2 = math.random(10, 20)
local number3 = math.random(10, 20)
local number4 = math.random(1, 10)
local number5 = math.random(1, 10)
if number4 > 5 then
number1 = number1 - (number1 * 2)
end
if number5 > 5 then
number3 = number3 - (number3 * 2)
end
local iS = iceSpike:Clone()
iS.Name = "iS"
iS.Parent = workspace.Attack_Parts
iS.Position = Vector3.new(pos.X + number1, pos.Y + number2, pos.Z + number3)
iS.CFrame = CFrame.lookAt(iS.Position, pos)
local tween = ts:Create(iS, ti, goals)
tween:Play()
wait(0.1)
num = num - 1
end
print("while loop ended")
wait(3)
end)
