I'm not sure if I'm missing something right in front of me but, I have a folder where it'll get the children of and run the loop for pairs but instead it'll only get one instead of them all?
function CreateDisplay(Weapon, ViewFrame) print("Create Display Function") local Display = Displays.Weapons:WaitForChild(Weapon):Clone() Display.Name = "Model" Display.Parent = ViewFrame local Camera = Instance.new("Camera", ViewFrame) ViewFrame.CurrentCamera = Camera local CameraPosition = Vector3.new(0,0,4) Camera.CFrame = CFrame.new(Display.PrimaryPart.Position + CameraPosition) while true do if ViewFrame:FindFirstChildOfClass("Model") then Display:SetPrimaryPartCFrame(Display:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(0,.025,0)) wait() else break end end end function CreateList() print("Create List Function") for Index, Found in pairs(game.ReplicatedStorage.AvailableTags.Legal:GetChildren()) do print(Found.Name) local ItemClone = Template:Clone() ItemClone.Visible = true ItemClone.Name = Found.Name ItemClone.Parent = List CreateDisplay(ItemClone.Name, ItemClone) ItemClone.Select.MouseEnter:connect(function() ItemClone.Select.TextColor3 = Color3.new(255/255, 170/255, 0/255) end) ItemClone.Select.MouseLeave:connect(function() ItemClone.Select.TextColor3 = Color3.new(255/255, 255/255, 255/255) end) ItemClone.Select.MouseButton1Click:connect(function() if game.ReplicatedStorage.AvailableTags.Legal:FindFirstChild(ItemClone.Name) then print("Select Item") end end) end end
I've found the issue to my problem, and what the predicament had been was my loop to rotate the model of the display. So what I had done to fix this was, completely remove that loop and then separately moved it into it's own function and calling on that function after the display is created something along the lines of this.
function RotateDisplay(Display, ViewFrame) while true do if ViewFrame:FindFirstChildOfClass("Model") then Display:SetPrimaryPartCFrame(Display:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(0,.025,0)) wait() else break end end end function CreateDisplay(Weapon, ViewFrame) print("Create Display Function") local Display = Displays.Weapons:WaitForChild(Weapon):Clone() Display.Name = "Model" Display.Parent = ViewFrame local Camera = Instance.new("Camera", ViewFrame) ViewFrame.CurrentCamera = Camera local CameraPosition = Vector3.new(0,0,4) Camera.CFrame = CFrame.new(Display.PrimaryPart.Position + CameraPosition) RotateDisplay(Display, ViewFrame) end