I'm trying to loop a i,v statement to check workspace if a certain item is there. I have a while true do loop activating when I press a button, but it doesn't work on the new instances being added to the workspace. Here's what I currently have.
local character = game.Players.LocalPlayer.Character
local hum = character.HumanoidRootPart
local work = game.Workspace:GetChildren()
while valuee == true do -- this code is in a function
wait(1)
for i,v in pairs(work) do
if v.Name == "Test" then
v.CFrame = work.Part.CFrame
end
if valuee == false then
break
end
end
end

3 comments
its because you are checking the same table every loop, you need to create the table inside the loop.
Would the table have to specify the item?
"work.Part.CFrame" but work is a table. replace that part with workspace.Part.CFrame