Hey,
Basically what I am trying to make is a skill (photos below) I have default row of Butterflies (purple parts) but I want to make it look better so I want to add more butterflies (10-15) but in random positions, so it will look better, a bit above/left/right/down.
the issue with my current script is that it spawns new parts but all of them get stuck together in the middle so all 10new parts are in the middle for some reason.
I first was using CFrame and now I changed to just positions but both of them cause the same issue.
local RS = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Insect = RS:WaitForChild("Insect")
Insect.OnServerEvent:Connect(function(player,Current)
if Current == "E" and player.TemporaryValues.Using.Value == false and player.TemporaryValues.First.Value == 0 then
local First = game.ServerStorage.Insect:Clone()
First.Name = player.Name
local hrpCFrame = player.Character.HumanoidRootPart.CFrame
First:SetPrimaryPartCFrame(hrpCFrame + Vector3.new(0,1,0))
for i = 0,10,1 do
local Purple = First.Purple:Clone()
local Wings = First.Wings:Clone()
local x = math.random(-10,10)
local z = math.random(-3,3)
local y = math.random(-1,1)
Purple.Parent = First
Wings.Parent = First
Purple.Position = Vector3.new(hrpCFrame.p + Vector3.new(x,y,z))
Wings.CFrame = Purple.CFrame
local Weld = Instance.new("ManualWeld",First.Main)
Weld.Part0 = First.Main
Weld.Part1 = Purple
local Weld2 = Instance.new("ManualWeld",First.Main)
Weld2.Part0 = First.Main
Weld2.Part1 = Wings
end
First.Parent = workspace
player.TemporaryValues.Using.Value = true
player.TemporaryValues.First.Value = 6
local part = First.Main
local hrp = player.Character.HumanoidRootPart
local WaitTime = 0.7
local goal = {}
goal.Position = hrpCFrame * Vector3.new(0,0,-60)
local goal2 = {}
goal2.Position = hrpCFrame * Vector3.new(0,0,-61)
local tweenInfo = TweenInfo.new(WaitTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
local tween = TweenService:Create(part, tweenInfo, goal)
local tween2 = TweenService:Create(hrp, tweenInfo, goal2)
tween2:Play()
tween:Play()
wait(WaitTime)
-- First:Destroy()
game.ReplicatedStorage.Insect:FireClient(player)
player.TemporaryValues.Using.Value = false
end
end)
^ this is the default row

^and this is after the code, parts get stuck in the middle
(the row is fine butterflies are there, but the butterflies which were added from the script gets stuck in the middle)
