Hello everyone!
So I want to make a Bollard System inside of Roblox Studio and I get the error
Enable to find: Main
Enable to find: End
The problem is that the Main & End are in the game and are not removed from the game.
This is the script :
local bollardsLowered = false
Settings.Data.Bollards1.ModelData.ProximityPrompt.Triggered:Connect(function()
if not bollardsLowered then
local tweens = {}
local flashes = {}
local Folder = Settings.Data.Bollards1.ModelData.BollardFolder:GetDescendants()
for _, bollard in pairs(Folder) do
if bollard:IsA("Model") then
local Main = bollard:FindFirstChild("Main")
local End = bollard:FindFirstChild("End")
if Main and End then
local OriginalLedsCFr = Main:FindFirstChild("Leds").CFrame
local OriginalCFrame = End.Union.CFrame
local tween1 = TweenService:Create(Main.Leds, info, {CFrame = End.Leds.CFrame})
local tween2 = TweenService:Create(Main.Union, info, {CFrame = End.Union.CFrame})
table.insert(tweens, tween1)
table.insert(tweens, tween2)
table.insert(flashes, function() Flash(bollard, false, OriginalLedsCFr, End.Union.CFrame) end) -- Ajouter la fonction Flash
else
warn("Enable to find: ", bollard.Name)
end
end
end
for _, tween in ipairs(tweens) do
tween:Play()
end
for _, flashFunc in ipairs(flashes) do
flashFunc()
end
bollardsLowered = true
table.clear(tweens)
else
local tweens = {}
local Folder = Settings.Data.Bollards1.ModelData.BollardFolder:GetDescendants()
for _, bollard in pairs(Folder) do
if bollard:IsA("Model") then
local Main = bollard:FindFirstChild("Main")
local End = bollard:FindFirstChild("End")
if Main and End then
local OriginalLedsCFr = Main:FindFirstChild("Leds").CFrame
local OriginalCFrame = End.Union.CFrame
local tween1 = TweenService:Create(Main.Leds, info, {CFrame = OriginalLedsCFr})
local tween2 = TweenService:Create(Main.Union, info, {CFrame = OriginalCFrame})
table.insert(tweens, tween1)
table.insert(tweens, tween2)
Flash(bollard, true, OriginalLedsCFr, End.Union.CFrame)
end
end
end
for _, tween in ipairs(tweens) do
tween:Play()
end
bollardsLowered = false
end
end)
Workspace Screenshot :
Video :
Untitled Game - Roblox Studio 2024-04-01 15-26-13.mp4 - Google Drive
All reply helps!