Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why Cant My Parts Ever Move?

Asked by 3 years ago

So Im Trying To Make A Maze Generator And At First I've Been Trying To Generate A Grid But When I Try And Duplicate the X Axis And Move It It Doesnt Move And I Did As A Test To Teleport The Duplicated Parts To 0,0,0 And Thats Not Working Either So What Is Going On Heres The Script btw

BIG = {X = 100, Y = 100, Z = 5}
Chunks = 20
Ratio = BIG.X*BIG.Y
Size = 1
T = 0
function X() -- Generating The X Value
    for i = 1,(Chunks * 10) do
        local ChunkSplit = T*(Chunks)
        print(ChunkSplit)
        local Part = Instance.new("Part")
        Part.Position = Vector3.new(0 - ChunkSplit,BIG.Z,0)
        Part.Size = Vector3.new(Chunks,Size,Size)
        Part.Anchored = true
        Part.Name = T
        Part.Parent = game.Workspace
        if T == Chunks then
            local Model = Instance.new("Model")
            Model.Parent = game.Workspace
            Model.Name = "X"
            for i = 0,Chunks do
                game.Workspace:WaitForChild(i).Parent = Model
            end
            break
        end
        T = T + 1
    end
end
function Y() -- Generating Duplicate X Blocks
    T = 0
    local XC = game.Workspace.X:GetChildren()
    local X = game.Workspace.X
    print(XC)
    for i = 1,#XC do -- Duplicates Blocks
        T = T + 1
        local Clone = X:Clone()
        local CloneC = X:Clone():GetChildren()
        Clone.Parent = game.Workspace
        print(CloneC)
        local ChunkSplit = T * Chunks
        for i = 1,#CloneC do -- Moves Indivual Blocks
            print(CloneC[i])
            CloneC[i].Position = Vector3.new(0,0,0)
        end
    end
end
X()
Y()

so uh I don't know what's wrong can anybody tell me what's happening or give me the fixed code please?

0
bruh excuse me you cant move anchored parts :v you anchored "T" at line 13 making it immovable. NGC4637 602 — 3y
0
perhaps you can make it massless to make sure it doesn't fall to the floor? NGC4637 602 — 3y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

At line 36, you did not set CloneC's parent. The parent was turned to nil, therefore there is no reason to error when you put a part parent to nil. Consider set CloneC parent to workspace

Ad

Answer this question