Hi, so I’ve had this issue where people were on the occasion randomly losing items on their base. I have been FINALLY provided with an error to do with the data module by 1 of the players; however, said error confuses me.
Here’s a copy of the base load script.
function DataLib.TableToBase(Player, Table, Target)
local Baseplate = Target.Baseplate
local BaseCorner = Baseplate.CFrame * CFrame.new(Vector3.new(Baseplate.Size.X / 2, 0, Baseplate.Size.Z / 2))
for i, Object in pairs(Table) do
if Object.ItemName ~= nil then
local Item
if game.ReplicatedStorage.Items:FindFirstChild(Object.ItemName) then
Item = game.ReplicatedStorage.Items[Object.ItemName]
else
Item = ItemFromId(Object.ItemName)
end
local HitboxDirection = Vector3.new()
local DirectionValue = Object.Position[4]
if Player ~= nil then
if Item ~= nil then
Item = Item:Clone()
Item.Parent = Target.ItemHolder
local Position = BaseCorner * Vector3.new(Object.Position[1], Object.Position[2], Object.Position[3])
local lookVector = Vector3.new(Object.Position[4], Object.Position[5], Object.Position[6])
local CoordinateFrame = CFrame.new(Position, Position + (lookVector * 5))
Item:SetPrimaryPartCFrame(CoordinateFrame)
if Item:FindFirstChild("Drop") then
for i,v in pairs(Item:GetChildren()) do
if v:FindFirstChild("DropScript") and Player.Difficulty.Value == "Nightmare" then
v.DropScript.DropStats.DropDelay.Value = Item.Drop.DropScript.DropStats.DropDelay.Value * 3
end
end
end
SetScriptToggle(Item, false)
if Item.Information:FindFirstChild("Producing") then
Item.Information.Producing.Value = true
end
else
print("Item with ID " .. Object.ItemName .. " could not be found!")
end
end
end
end
end
The issue occurs when I clone the Item:
Item = Item:Clone()
Does anyone have any idea why this error occurs? Thanks for any help.