I am trying to return a cloned instance with a remotefunction, and it returns nothing on the client.
Server (prints the cloned instance fine, and returns it):
function spawnMag(mag: Instance)
if mag then
local m = mag:Clone()
m.Parent = workspace
return m
end
end
remote.OnServerInvoke = function(player,name)
local mag = mags:FindFirstChild(name)
return spawnMag(mag)
end
Client Module (function fires and all, but the mag variable is nil?):
function module:SpawnMag(gunName: string)
local name = gunName.."_Mag"
local mag = event:InvokeServer(name)
return mag
end
Not used to RemoteFunctions, and I belive I may have made an oversight.
local rns = game:GetService("RunService")
function module:SpawnMag(gunName: string)
local name = gunName.."_Mag"
local mag = event:InvokeServer(name)
rns.Stepped:Wait()
return mag
end