-
What do you want to achieve? Make a script loop but make it repeat only 5 times
-
What is the issue? idk how to make it clone only 5 times
-
What solutions have you tried so far? I saw some topics but I didn’t understand
This is the script so who can edit it and make it repeat only 5 times and ty
local player = game.Players.PlayerAdded:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats2")
local Dif = leaderstats:WaitForChild("Dif")
while script.Disabled == false do
wait(Dif.Value)
local Laser = game.ReplicatedStorage.MainLaser
local Clone1 = Laser:Clone()
local Road1 = game.Workspace.RoadModel.Right
local boundsX1 = math.random(-Road1.Size.X/2, Road1.Size.X/2)
Clone1.Position = (Road1.Position + Vector3.new(boundsX1,Road1.Position.Y))
Clone1.Parent = workspace.Obstacles
local Road2 = game.Workspace.RoadModel.Mid
local boundsX2 = math.random(-Road2.Size.X/2, Road2.Size.X/2)
local Clone2 = Laser:Clone()
Clone2.Position = (Road2.Position + Vector3.new(boundsX2,Road2.Position.Y))
Clone2.Parent = workspace.Obstacles
local Road3 = game.Workspace.RoadModel.Left
local boundsX3 = math.random(-Road3.Size.X/2, Road3.Size.X/2)
local Clone3 = Laser:Clone()
Clone3.Position = (Road3.Position + Vector3.new(boundsX3,Road3.Position.Y))
Clone3.Parent = workspace.Obstacles
end
end)