For i,v loop not working properly
I’m trying to get everything in the workspace and put it into a viewport frame but it keeps trying to put the terrain in even though I’ve put an if statement to make sure that it does not take those items.
local ToolBar = plugin:CreateToolbar("Alpha")
local PluginButton = ToolBar:CreateButton("", "Alpha", "")
local New_Gui = Instance.new("ScreenGui")
New_Gui.Enabled = false
New_Gui.Name = "Gui"
New_Gui.Parent = game.CoreGui
local Viewport_Frame = Instance.new("ViewportFrame")
Viewport_Frame.BackgroundColor3 = Color3.fromRGB(95, 95, 95)
Viewport_Frame.CurrentCamera = workspace.Camera
Viewport_Frame.Size = UDim2.fromScale(1,1)
Viewport_Frame.Parent = New_Gui
for i,v in pairs(workspace:GetChildren()) do
if v.ClassName ~= "Terrain" or "Camera" then
v.Parent = Viewport_Frame
end
end
PluginButton.Click:Connect(function()
New_Gui.Enabled = not New_Gui.Enabled
end)