✓ Accepted answer
theres a few problems.
don't use the parent parameter for instance.new, its slow. (only set the parent param if you aren't gonna change any other properties. Otherwise, set the parent property last)
(main problem). you aren't returning the part you instance.new()ed in the server, therefore its not working.
to fix 2, you need to use a remotefunction instead of a remoteevent.
here is the fixed script:
local script
function instance(a,b)
if b then
return game:GetService("ReplicatedStorage"):WaitForChild("Instance"):InvokeServer(a,b)
elseif not b then
return game:GetService("ReplicatedStorage").WaitForChild("Instance"):InvokeServer(a)
end
end
local cool = instance("Part")
cool.Name = "lol"
print(cool.Name)
server script
local RF = game:GetService("ReplicatedStorage"):WaitForChild("Instance")
RF.OnServerInvoke = function(class:string, parent)
local newPart = Instance.new(class)
if parent and parent:IsA("Instance") then
newPart.Parent = parent
end
return newPart
end
3 comments
I feel like this can be exploited
tbh, same.
Yeah but its a private project for me and some friends.