Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Model from ReplicatedStorage wont show for everybody when moved to workspace?

Asked by
BiIinear 104
5 years ago

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.

01wait(5)
02local player = game.Players.LocalPlayer
03 
04--Drop item
05script.Parent.MouseButton2Click: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
View all 25 lines...

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 answer

Log in to vote
1
Answered by
cegberry 432 Moderation Voter
5 years ago
Edited 5 years ago

You can’t clone stuff and then put it in another parent, with a LocalScript because of FilteringEnabled; FilteringEnabled is when a client make changes, the server won’t make the change for other clients; You may want to make it so, a LocalScript doesn’t do the cloning part, but the server does it

0
That makes a lot of sense, thanks. BiIinear 104 — 5y
Ad

Answer this question