You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Return a instance.
What is the issue? Include screenshots / videos if possible!
Cannot return a instance and always get a nil
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
ive legit looked everywhere but i cant fix it
--client
local maga = vrEvents.SpawnItem:InvokeServer(vrAssets.Assets.GunMags[mag])
--server
events.SpawnItem.OnServerInvoke=function(player: Player,item: Instance)
local clone = item:Clone()
clone.Parent = workspace.Pickups
wait()
return clone
end
When you transfer an object like this, it only transfers a reference to the object. If the object doesn’t exist on the client/server, it will be nil. You’ll need to rework this so that the objects are created on the server and let Roblox handle the automatic replication to the clients.
In the client script, run game.ReplicatedStorage:WaitForChild("VR"):WaitForChild("Assets"):WaitForChild(...) at the beginning to make sure that they are replicated before asking the server.