Issue
Okay so my only issue is if the button is spammed, the bricks all go inside of each other. I am not entirely sure how I can prevent that from happening.
https://gyazo.com/69f3a586b887f36f4077dc732e79debd
--Made By MillerrIAm & VersionQ
-------------Variables------------
local Event = game.ReplicatedStorage.ControlEvents.RotateLightsEvent
local MovementModule = require(game.ServerScriptService["Module Scripts | Lighting"].MovementModule)
local Enabled = false
local Num = 360
LightTable = {}
------------Main Script------------
Event.OnServerEvent:Connect(function(plr,Lights,Activate)
if Activate == true then
Enabled = true
if Enabled == true then
for i = 1,#LightTable do
if #LightTable == nil or #LightTable == 0 then return end
table.remove(LightTable,i)
end
for i,v in ipairs (game.Workspace.VenueLights[Lights]:GetChildren()) do
table.insert(LightTable,v.CFrame)
end
for x,v in ipairs (game.Workspace.VenueLights[Lights]:GetChildren()) do
spawn(function()
repeat
MovementModule.Tween(v,Vector3.new(v.Orientation.X,v.Orientation.Y + Num,-145),nil)
wait(0.5)
until Enabled == false
if #LightTable == nil or #LightTable == 0 then return end
for i,v in ipairs (game.Workspace.VenueLights[Lights]:GetChildren()) do
v.CFrame = LightTable[i]
end
end)
end
end
elseif Activate == false then
Enabled = false
end
end)
Thank you for any help you can give me