for i = 1,100 do wait(0.3)
local rock1 = game.ReplicatedStorage.Items.Rock:Clone()
local rock2 = game.ReplicatedStorage.Items.Rock:Clone()
local rock3 = game.ReplicatedStorage.Items.Rock:Clone()
table.insert(rocks,rock1)
table.insert(rocks,rock2)
table.insert(rocks,rock3)
for i,v in pairs (rocks) do
local x = math.random(1,game.Workspace.Region.Position.X)
local y = math.random(1,game.Workspace.Region.Position.Y)
local Z = math.random(1,game.Workspace.Region.Position.Z)
v.Position = Vector3.new(x,y,Z)
v.Parent = game.Workspace
v.CFrame = v.CFrame * CFrame.Angles(0.5,0,0)
end
for i,v in pairs (rocks) do
---making a rocketpropulsion
local rockprop = Instance.new("RocketPropulsion",v)
rockprop.Target = orb
rockprop.MaxSpeed = 450000
rockprop.MaxThrust = 450000
rockprop.TurnD = math.random(200,300)
rockprop.TurnP = math.random(200,300)
v.Anchored = false
rockprop:Fire()
local rockpropreached = script.RockPropReached:Clone()
rockpropreached.Parent = v
end
local position = table.find(rocks,rock1)
local position2 = table.find(rocks,rock1)
local position3 = table.find(rocks,rock1)
table.remove(rocks,position)
table.remove(rocks,position2)
table.remove(rocks,position3)
---removing all the parts from the table
end
Hello, I changed the minimum of X and Y to be the negative of my maximum, however, this seems to have the same effect.
local x = math.random(-game.Workspace.Region.Position.X,game.Workspace.Region.Position.X)
local y = math.random(-game.Workspace.Region.Position.Y,game.Workspace.Region.Position.Y)
I just now noticed you were only using the region’s position. This doesn’t make very much sense, as the area you need to place it in depends on the size and position of the green part.
Try using this instead:
local region = game.Workspace.Region
local size = region.Size / 2
local x = math.random(-size.X,size.X)
local y = math.random(-size.Y,size.Y)
local z = math.random(-size.Z,size.Z)
v.Position = region.CFrame * Vector3.new(x,y,z) -- Multiply the region's CFrame with the size to position it
(This isn’t tested, so I may have done the CFrame part wrong)