So I was just wondering if there’s a better way to transfer instances (like baseparts/models/etc that are inside game.ServerStorage) to the client side. I understand I can just place them all in ReplicatedStorage but I don’t really want exploiters getting ahold of all the assets easily.
Right now I’m using a remote function to get models from server to client.
--ServerSide
local RemoteFunction = game.ReplicatedStorage:WaitForChild('RemoteFunction');
local function onFunction(player, InstanceName)
local Model = game.ServerStorage:FindFirstChild(InstanceName);
if Model then
local ClonedModel = Model:Clone();
game.Debris:AddItem(ClonedModel, 5); --Remove it so less instances inside replicatedstorage
ClonedModel.Parent = game.ReplicatedStorage;
return ClonedModel;
end
end
RemoteFunction.OnServerInvoke = onFunction;
--ClientSide
local RemoteFunction = game.ReplicatedStorage:WaitForChild('RemoteFunction');
local function GetModel(ModelName)
local Model = RemoteFunction:InvokeServer(ModelName);
if Model then
local ClonedModel = Model:Clone();
--[[
Do whatever with the cloned model afterwards...
]]--
end
end
It just seems like cloning once in server then sending to client just to have it cloned again seems tedious and ineffective, and I don’t want to placed cloned instance inside ReplicatedStorage where every user might possibly lag from the instance being inserted (idk do they lag from it being inserted)? Since each client’s viewpoint is different, I can’t use ServerScript to insert objects manually.
Is there any possible way for me to send only one instance to one client without cloning multiple times and still making it harder for exploiters to gain access of the instance?