32 lines
1.3 KiB
Plaintext
32 lines
1.3 KiB
Plaintext
local function load_bil_gui()
|
|
local player = game.Players.LocalPlayer
|
|
local gui = player:WaitForChild("PlayerGui")
|
|
local bil_gui = game.StarterPlayer.StarterPlayerScripts.BilGui -- BilGui 是一个文件夹
|
|
|
|
print("加载bilgui开始")
|
|
-- 将 BilGui 加载到指定的 UI 预制体中
|
|
for _, folder in ipairs(bil_gui:GetChildren()) do
|
|
if folder:IsA("Folder") then
|
|
local target_ui = gui:WaitForChild(folder.Name)
|
|
if target_ui then
|
|
for _, script in ipairs(folder:GetChildren()) do
|
|
if script:IsA("LocalScript") then
|
|
local target_frame = target_ui:WaitForChild(script.Name) -- 找对应脚本名字的frame
|
|
if target_frame then
|
|
local script_clone = script:Clone()
|
|
script_clone.Parent = target_frame
|
|
print("加载成功: " .. script.Name)
|
|
else
|
|
warn("目标 Frame 未找到: " .. script.Name)
|
|
end
|
|
end
|
|
end
|
|
else
|
|
warn("目标 UI 预制体未找到: " .. script.Name)
|
|
end
|
|
end
|
|
end
|
|
print("加载bilgui结束")
|
|
end
|
|
|
|
load_bil_gui() |