首页 > 解决方案 > Roblox 武器套件在移动到复制存储时会损坏

问题描述

我已尝试应用此处发布的修复程序,但仍然无法正常工作。我的游戏中有一把来自武器套件的武器。我已按照此处的建议将 WeaponsSystem 文件夹移至 ReplicatedStorage 。游戏开始时,我的武器会在几秒钟后消失。

我已经删除了 ServerWeaponsScript 第 60 行的条件,并且我还注释掉了任何引用 curWeaponsSystemFolder 的内容。无法让它工作。我在下面发布了我的更改,包括我注释掉的所有行。

-- local curWeaponsSystemFolder = script.Parent
--if weaponsSystemFolder == nil then
--  weaponsSystemFolder = curWeaponsSystemFolder:Clone()
--  initializeWeaponsSystemAssets()
--  weaponsSystemFolder.Parent = ReplicatedStorage
--end

--if ServerScriptService:FindFirstChild("ServerWeaponsScript") == nil then
script.Parent = ServerScriptService
initializeWeaponsSystemAssets()

local WeaponsSystem = require(weaponsSystemFolder.WeaponsSystem)
if not WeaponsSystem.doingSetup and not WeaponsSystem.didSetup then
    WeaponsSystem.setup()
end

local function setupClientWeaponsScript(player)
    local clientWeaponsScript = player.PlayerGui:FindFirstChild("ClientWeaponsScript")
    if clientWeaponsScript == nil then
        clientWeaponsScript = weaponsSystemFolder.ClientWeaponsScript:Clone()
        clientWeaponsScript.Parent = player.PlayerGui
    end
end

Players.PlayerAdded:Connect(function(player)
    setupClientWeaponsScript(player)
end)

for _, player in ipairs(Players:GetPlayers()) do
    setupClientWeaponsScript(player)
end

--end


--if curWeaponsSystemFolder.Name == "WeaponsSystem" then
--  curWeaponsSystemFolder:Destroy()
--end

标签: roblox

解决方案


推荐阅读