I made a function that will spawn pipes every 3.5 sec:
local function MakePillar()
while dead == false do
local newNum = Center()
local model = Instance.new("Model",game.Workspace.PillarsFolder)
model.Name = "Pillars"
local newPillar = Pillar:Clone()
newPillar.Name = "newPillar"
newPillar.Parent = model
newPillar.Size = Vector3.new(3,newNum -Distance,3)
newPillar.Position = Vector3.new(offset,newPillar.Size.Y/2 - Distance,0)
points[1] = newPillar
local newPillar2 = Pillar:Clone()
newPillar2.Name = "newPillar2"
newPillar2.Parent = model
newPillar2.Size = Vector3.new(3,27 - newNum - Distance,3)
newPillar2.Position = Vector3.new(offset,(27 - newPillar2.Size.Y/2)+Distance,0)
points[2] = newPillar2
for i = 1, #points do
tweenPart(points[i], 15, {Position = points[i].Position - Vector3.new(60,0,0)})
end
wait(3.5)
end
end
and here is the event that triggers the function:
mouse.Button1Down:Connect(function()
if IsPlaying == false then
IsPlaying=true
dead = false
print("game started!")
---------------------------------------------------------------------------
--Hide the text Uis
ScreenGUI.Enabled = false
--Enable physics
Character.HumanoidRootPart.Anchored = false
----------------------------------------------------------------------------------
MakePillar()
---------------------------------------------------------------------------------------
end
end)
for some reasons SOMETIMES (not always) my function get trigger multiple times at once, can anyone explain?
You can ask me any questions about the local script, i will try to answer them

2 comments
I'm sorry but this didn't fix the problem, plus if i was pressing twice then i think the "game started" should print twice too
use script analyser then