0

I've tried applying the fix posted here but I still can't get it to work. I have one weapon from the Weapons Kit in my game. I've moved the WeaponsSystem folder to ReplicatedStorage as recommended here . When the game starts, my weapon disappears after a couple seconds.

I've removed the conditional on line 60 of ServerWeaponsScript and I also commented out anything that references curWeaponsSystemFolder. Can't get it to work. I posted my changes below, including all the lines I commented out.

-- 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
C Paynter
  • 61
  • 5
  • Is this a Script in ReplicatedStorage? Is the issue that it no longer runs when you join the game? Or that a weapon you have vanishes? – Kylaaa Dec 30 '20 at 17:29
  • Yes, the problem occurs when I move the WeaponsSystem folder to ReplicatedStorage. This is what the documentation says to do. However, when I do this the weapon disappears. The weapon itself is just sitting in the Workspace as a pickup item. What I've ended up doing as a workaround is having one weapon with the WeaponsSystem folder, then deleting that folder from the remaining weapons. When the game starts, the game then copies that one folder to ReplicatedStorage and it works for all weapons. – C Paynter Jan 01 '21 at 00:52

0 Answers0