It depends on your implementation. In your specific case, I’d advise against using parts if your goal is to have single particles emit at random locations. A better choice might (I say might because I don’t actually know what you’re trying to do) be to parent an Attachment to terrain. CFrame the attachment, emit the particle, delay, repeat. You could have a single attachment + emitter and just randomly emit around your area. That, or better yet, just make a big part and use Roblox’s random placement (but I assume you’re avoiding that for a reason).
To answer your question, I’d advise having it all in one single function, wait included. That, or use spawn instead of coroutine.wrap as spawn ties into Roblox’s scheduler (same system as wait for the most part)
It could be done relatively easily, the issue is that there’s no real purpose for it unless you’re building close to the preset position, which would cause other far more severe problems for your game
Oh yeah! I hadn’t actually realized it was released. I can do that ASAP.
Edit: Update is out. Of course, scripts may show a number of false warnings due to type checking beta. There is now a “README” script in the module that goes over what to expect.
I am looking through the module code but unable to figure out where I change the default parent object for the cached parts.
Now they are all parented to the Workspace.
Is it possible to specify the parent object for each cache?
Sorry to put this warning here but I can’t create a new topic in Studio Bugs.
This warning comes up when I open the script for PartCache, its something about Free types.
This is the first time I have tried to use PartCache and the warning came up.
It is in the PartCache module script.
Please try to actually describe what’s wrong. What you’ve effectively done is sat down at a restaurant, and told the waiter “Yes, please give me some food.”
I’m going to need to know what the problem actually is if you want guidance on it. When is this happening?
Sorry for the late response, came here from a hyperlink.
Anyways for a solution I handled objects that aren’t necessary to the server, like bullet trails (that don’t need collision) on the client. Reduced the Network problem.
Essentially what was wrong is I was using part cache only on the server. I had to make my own for the client but it didn’t take too long thanks to you making your scripts easy to read, thank you.
local RandomPosModule = require(script.RandomPositionModule)
local PartCacheModule = require(script.Parent.PartCache)
local Droplet = game.ReplicatedStorage.RainDroplet
local ModuleRain = PartCacheModule.new(Droplet, 50)
while wait() do
for i = 1,(script.Parent.Amount.Value) do
local DropletClone = PartCacheModule.GetPart(ModuleRain)
DropletClone.Parent = workspace
RandomPosModule.RandomPosition(script.Parent,DropletClone)
end
end
local RandomPosModule = require(script.RandomPositionModule)
local PartCacheModule = require(script.Parent.PartCache)
local Droplet = game.ReplicatedStorage.RainDroplet
local ModuleRain = PartCacheModule.new(Droplet, 50)
while wait() do
for i = 1,(script.Parent.Amount.Value) do
local DropletClone = PartCacheModule.GetPart(ModuleRain)
DropletClone.Parent = workspace
RandomPosModule.RandomPosition(script.Parent,DropletClone)
ModuleRain:ReturnPart(DropletClone)
end
end
so now theres no errors, but its not spawning. Its just staying un-used
You’re instantly returning to the cache afterwards. You’ll probably want something like this.
local RandomPosModule = require(script.RandomPositionModule)
local PartCacheModule = require(script.Parent.PartCache)
local Droplet = game.ReplicatedStorage.RainDroplet
local ModuleRain = PartCacheModule.new(Droplet, 50)
while true do
local parts = {}
for i = 1,(script.Parent.Amount.Value) do
local DropletClone = PartCacheModule.GetPart(ModuleRain)
DropletClone.Parent = workspace
RandomPosModule.RandomPosition(script.Parent,DropletClone)
table.insert(parts, DropletClone)
end
wait()
for _, part in ipairs(parts) do
ModuleRain:ReturnPart(part)
end
end