Model from ReplicatedStorage wont show for everybody when moved to workspace?
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.
02 | local player = game.Players.LocalPlayer |
05 | script.Parent.MouseButton 2 Click:Connect( function () |
06 | if script.Parent.ItemNameValue.Value ~ = '' then |
07 | if player.Backpack:FindFirstChild(script.Parent.ItemNameValue.Value) then |
08 | local itemclone = game.ReplicatedStorage [ script.Parent.ItemNameValue.Value ] :Clone() |
09 | player.Backpack [ script.Parent.ItemNameValue.Value ] :Destroy() |
10 | itemclone [ script.Parent.ItemNameValue.Value ] .CanCollide = true |
11 | itemclone [ script.Parent.ItemNameValue.Value ] .Anchored = false |
12 | itemclone [ script.Parent.ItemNameValue.Value ] .Position = player.Character.HumanoidRootPart.Position |
13 | local dropclone = game.Lighting.Values.DroppedItem:Clone() |
14 | dropclone.Parent = itemclone |
15 | itemclone.Parent = workspace |
16 | script.Parent.ItemNameValue.Value = '' |
17 | script.Parent.DescriptionValue.Value = '' |
18 | script.Parent.Active = false |
19 | script.Parent.Image = '' |
22 | print ( "Unable to drop, item equipped" ) |
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.