Oh, you're problem is that you're trying to index a table. You can't do that, you need to iterate through each object in the table instead. An example is here:
1 | p = game.Workspace:GetChildren() |
3 | if v:IsA( "BasePart" ) then |
4 | v.CFrame = v.CFrame + Vector 3. new( 0 , 0 , 10 ) |
So there's an example. To apply this to your script, we will keep everything else the same, and fix up your loop:
02 | if game.Workspace:FindFirstChild( "Stardrive" ) = = nil then |
03 | script.Parent.Sound.Pitch = 1 |
04 | script.Parent.Sound:play() |
06 | local s = game.ServerStorage.Stardrive:clone() |
07 | s.Parent = game.Workspace |
08 | game.Workspace.Separated.Value = true |
10 | local p = game.Workspace.Stardrive:GetChildren() |
13 | for i,v in pairs (p) do |
14 | v.CFrame = v.CFrame + Vector 3. new( 0 , 0 , 10 ) |
16 | until game.Workspace.Stardrive.Shape.Positon.Z < = 868.946 |
18 | if game.Workspace:FindFirstChild( "Stardrive" )~ = nil then |
19 | script.Parent.Sound.Pitch = - 1 |
20 | script.Parent.Sound:Play() |
21 | game.Workspace.Separated.Value = false |
22 | game.Workspace.Stardrive:destroy() |
27 | script.Parent.ClickDetector.MouseClick:connect(separate) |
Ok, so now your code should work correctly. If you have any further problems/questions, please leave a comment below. Hope I helped :P
-Dyler3