I have a script that duplicates a model from ServerStorage and sends it to the player's camera. It works in studio, but not in published mode.
game.ReplicatedStorage.rings.rings1.OnServerEvent:Connect(function(plrWhoFiredEvent) game.ServerStorage.rings:Clone().Parent = workspace.Camera wait(210) workspace.Camera.rings:Remove() end)
It seems that you have a networking issue. You setup an OnServerEvent
event to clone the models into the clients Camera.
This is a problem because you can only access the camera on the client, and OnServerEvent events are for the server. You have a backwards setup you see?
What you can do is reverse your setup so that you have the server calling a FireClient
function, and the client receiving it using the OnClientEvent
event.
Your setup would look like this;
Workspace
Script --> 'FireClient' on RemoteEvent.
ReplicatedStorage
RemoteEvent
StarterPack
LocalScript --> 'OnClientEvent' on RemoteEvent.
Remove
is deprecated! Use Destroy
!If you have any further questions feel free to ask.
Happy developing!