Oh thats ok, I don’t think I’ll need to make the number a float anyway.
@xXREDLION10Xx Could you help in case the other person went offline or something?
So the return part I couldnt tell if you were telling me to add something or just explaining so I didnt touch that.
I tried the script out and it wont spawn them.
There are no errors like usual.
local WeedMaker = {}
local OriginalWeed =game.ServerStorage.tumbleForce
-- Anchor it!
function WeedMaker.NewWeed(StartingPosition,Force)
local NewWeed = OriginalWeed:Clone()
NewWeed.Anchored = false
NewWeed.Parent = workspace
NewWeed.Position = Vector3.new(math.random(2341,-2342), 159.941, -3017.581)
local Force = Instance.new("BodyForce")
Force.Parent = NewWeed
Force.Force = Vector3.new(0,1,1000) -- I think this might not work, I don't know for sure, I dont really use bodyforces at all.
wait(10)
NewWeed:Destroy()
end
return WeedMaker
I need help in another reply since the script didn’t work. Sorry to annoy you if I have.
no don’t do that, do this instead
local MinPartSpawn = 10-- change as you'd like
local MaxPartSpawnTime = 20-- change as you'd like
local MinPartDeletionTime = 15
local MaxPartDeletionTime = 20
local decimals = 2--this just controls how many decimals are in a number (i.e. 2 is like 3.03 and 5 is like 8.02937 and 0 is like 5)
local spawnPosition = Vector3.new(0,0,0)-- the place where it spawns
local spawnArea = 80-- the area of the random spawn
local spawnMultiplier = Vector3.new(1,0,1)-- if you want it to just spawn at x then change it to Vector3.new(1,0,0)
local lastspawnedpart = 0-- don't touch this
local Newspawnpartnum = nil-- don't touch this either
local RunService = game:GetService("RunService")
RunService.Stepped:Connect(function(runtime,delta)
local mydecimals = math.max(10^decimals,1)
if Newspawnpartnum == nil then
Newspawnpartnum = math.random(MinPartSpawn*mydecimals,MaxPartSpawnTime*mydecimals)/mydecimals
end
if lastspawnedpart >= Newspawnpartnum then
print("Newpart",Newspawnpartnum)
lastspawnedpart = 0
Newspawnpartnum = math.random(MinPartSpawn*mydecimals,MaxPartSpawnTime*mydecimals)/mydecimals
local tumble = Instance.new("MeshPart")
local force = Instance.new("BodyForce")
local x = math.random(-spawnArea*mydecimals,spawnArea*mydecimals)/mydecimals
local y = math.random(-spawnArea*mydecimals,spawnArea*mydecimals)/mydecimals
local z = math.random(-spawnArea*mydecimals,spawnArea*mydecimals)/mydecimals
local v3 = Vector3.new(x,y,z)*spawnMultiplier
--tumble.MeshId = "rbxassetid://7545230286" you can't write mesh ids, roblox won't let you for now, use filemesh/specialmesh.Filemesh instead
tumble.Parent = workspace
tumble.TextureID = "rbxassetid://6879551990"
tumble.Material = Enum.Material.ForceField
tumble.Size = Vector3.new(20.218, 19.503, 16.909)
tumble.Position = spawnPosition+v3+Vector3.new(0,tumble.Size.Y/2,0)-- account for the size of stuff when moving them, or large objects will spaz-out
force.Parent = tumble
force.Force = Vector3.new(0,1,10000)
local newwait = math.random(MinPartDeletionTime*mydecimals,MaxPartDeletionTime*mydecimals)/mydecimals
task.delay(newwait,function()-- don't use delay/wait/spawn anymore, they're unreliable now, use task.delay/task.wait/task.spawn
tumble.Transparency = 0.8
force.Force = Vector3.new(0,0,0)
tumble:Destroy()
end)
else
lastspawnedpart = math.min(lastspawnedpart+delta,Newspawnpartnum)
print(math.floor(lastspawnedpart*mydecimals)/mydecimals)
end
end)
btw, if you want to spawn multiple at the same time, use a for i ,v loop
You need to clone the part or put the instance.new inside the loop for it to create multiple parts.
local tumble = Instance.new("MeshPart")
local force = Instance.new("BodyForce")
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
tuble = tumble:Clone()--you never cloned the object to make it multiple parts
wait(math.random(5, 6)) --thats set to really low wait time so I could test it---
tumble.Position = Vector3.new(math.random(2342, -2342), 159.941, -3017.581)
tumble.MeshId = "rbxassetid://7545230286"
tumble.Parent = workspace
tumble.TextureID = "rbxassetid://6879551990"
tumble.Material = Enum.Material.ForceField
tumble.Size = Vector3.new(20.218, 19.503, 16.909)
force.Parent = tumble
force.Force = Vector3.new(0,1,10000)
wait(math.random(10, 15))
tumble.Transparency = 0.8
force.Force = Vector3.new(0,0,0)
tumble:Destroy()
end)
Great thanks! Although could you possibly make it just clone the mesh part from serverstorage? That would be an easier solution.
sure, what’s the meshpart name(where it is and the name of it)?
Sure its game.ServerStorage.tumbleForce. The current part is anchored but I can unanchor if thats a problem.
EDIT: Oops, wrong reply, sorry!
I really appreciate the work you did to make this, but I’m actually going to use a different script from the one I originally put there since the new ones better. Thank you though!
it won’t really matter, you can do whatever you want to it, here you go! (btw, i added the multiple spawner value for you as well)
Full Script:
local MinPartSpawnTime = 10-- change as you'd like
local MaxPartSpawnTime = 20-- change as you'd like
local MinPartDeletionTime = 15
local MaxPartDeletionTime = 20
local MaxPartsToSpawn = 5
local MinPartsToSpawn = 1
local decimals = 2--this just controls how many decimals are in a number (i.e. 2 is like 3.03 and 5 is like 8.02937 and 0 is like 5)
local spawnPosition = Vector3.new(0,0,0)-- the place where it spawns
local spawnArea = 80-- the area of the random spawn
local spawnMultiplier = Vector3.new(1,0,1)-- if you want it to just spawn at x then change it to Vector3.new(1,0,0)
local lastspawnedpart = 0-- don't touch this
local Newspawnpartnum = nil-- don't touch this either
local RunService = game:GetService("RunService")
local original = game.ServerStorage.tumbleForce -- thepart to clone
RunService.Stepped:Connect(function(runtime,delta)
local mydecimals = math.max(10^decimals,1)
if Newspawnpartnum == nil then
Newspawnpartnum = math.random(MinPartSpawnTime*mydecimals,MaxPartSpawnTime*mydecimals)/mydecimals
end
if lastspawnedpart >= Newspawnpartnum then
print("Newpart",Newspawnpartnum)
lastspawnedpart = 0
Newspawnpartnum = math.random(MinPartSpawnTime*mydecimals,MaxPartSpawnTime*mydecimals)/mydecimals
for i = 1,math.random(MinPartsToSpawn,MaxPartsToSpawn),1 do
print("Spawned "..tostring(i))
local tumble = original:Clone()
local force = Instance.new("BodyForce")
local x = math.random(-spawnArea*mydecimals,spawnArea*mydecimals)/mydecimals
local y = math.random(-spawnArea*mydecimals,spawnArea*mydecimals)/mydecimals
local z = math.random(-spawnArea*mydecimals,spawnArea*mydecimals)/mydecimals
local v3 = Vector3.new(x,y,z)*spawnMultiplier
tumble.Parent = workspace
tumble.Position = spawnPosition+v3+Vector3.new(0,tumble.Size.Y/2,0)-- account for the size of stuff when moving them, or large objects will spaz-out
force.Parent = tumble
force.Force = Vector3.new(0,1,10000)
local newwait = math.random(MinPartDeletionTime*mydecimals,MaxPartDeletionTime*mydecimals)/mydecimals
task.delay(newwait,function()-- don't use delay/wait/spawn anymore, they're unreliable now, use task.delay/task.wait/task.spawn
tumble.Transparency = 0.8
force.Force = Vector3.new(0,0,0)
tumble:Destroy()
end)
end
else
lastspawnedpart = math.min(lastspawnedpart+delta,Newspawnpartnum)
end
end)
(p.s let me know if there’s any errors ok?)
I didn’t see this, sorry, but yeah that’s good, just make sure to account for the size of the part when moving it ok?
The script is function as its supposed too, which is great! Only one thing left to change for my super picky self to be satisfied(sorry about that by the way lol)
I noticed the tumbles are spawning randomly in a radius almost, which I get why since you put area. But is there a way to make it just spawn from -2342 to 2342 on the x axis when spawned(and some on the y axis)? Again, sorry for the continual script changes that I keep requesting.
Also, with these timings of spawning and deleting, will it cause buildup on the server? I dont want that happening
Well, no, and yes.
The way i did it, made sure that wouldn’t happen, but the amount of active physical objects in the workspace is the thing to worry about, if there are a lot of physically active objects at once, then of course it will lag, I’m not too sure what’s the limit, but I think it’s around 20 if you’re using big parts, and like 70-80 if you’re using smaller parts.
So yes, be careful of how many are active at once, you can control this by watching how many spawn at the same time, try to keep that MaxDestroy time low
yes, I labeled the center of the random location “spawnPosition” and you can control the area of which by changing “spawnArea”, which is just the size of where it will spawn, if you want to limit the axis of the spawn, change the value “spawnMultiplier”, so basically, change all these values to this
local spawnPosition = Vector3.new(-2342, 159.941, -3017.581)-- the place where it spawns
local spawnArea = 4684--(it's just 2324*2) the area of the random spawn
local spawnMultiplier = Vector3.new(1,0,0)-- pretty much just the spawn axis
See? It’s not so hard, just account for the size of the objects okay?