I've been developing an inventory system, so far the progress is going great. But this error just overall confuses me. It probably has to do something with it being a localscript, or the model coming from ReplicatedStorage.
wait(5)
local player = game.Players.LocalPlayer
--Drop item
script.Parent.MouseButton2Click:Connect(function()
if script.Parent.ItemNameValue.Value ~= '' then
if player.Backpack:FindFirstChild(script.Parent.ItemNameValue.Value) then
local itemclone = game.ReplicatedStorage[script.Parent.ItemNameValue.Value]:Clone()
player.Backpack[script.Parent.ItemNameValue.Value]:Destroy()
itemclone[script.Parent.ItemNameValue.Value].CanCollide = true
itemclone[script.Parent.ItemNameValue.Value].Anchored = false
itemclone[script.Parent.ItemNameValue.Value].Position = player.Character.HumanoidRootPart.Position
local dropclone = game.Lighting.Values.DroppedItem:Clone()
dropclone.Parent = itemclone
itemclone.Parent = workspace
script.Parent.ItemNameValue.Value = ''
script.Parent.DescriptionValue.Value = ''
script.Parent.Active = false
script.Parent.Image = ''
print("Item dropped")
else
print("Unable to drop, item equipped")
end
end
end)
What the script does is when you right click on an occupied slot in the inventory, it drops the item into the workspace. This works by cloning the exact item from ReplicatedStorage and parenting it to workspace. But apparently, it gets parented to workspace, but it wont show for any other players. I've even tried cloning from CurrentCamera. Does anybody have a solution to this? I think the problem is coming from the fact that a localscript is firing this, I'm not sure.

1 comment
That makes a lot of sense, thanks.