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.
1 | game.ReplicatedStorage.rings.rings 1. OnServerEvent:Connect( function (plrWhoFiredEvent) |
2 | game.ServerStorage.rings:Clone().Parent = workspace.Camera |
3 | wait( 210 ) |
4 | workspace.Camera.rings:Remove() |
5 |
6 | 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!