local model = game.Workspace.Section
model.PrimaryPart = model.MainPart
local position = model.PrimaryPart
script.Parent.MouseButton1Click:Connect(function() -- this is linked to the TextButton located inside starterGUI
while wait(0.001) do
model:MoveTo(position.Position + Vector3.new(3,0,0))
end
end)
I'm not getting an error but the model doesn't move when I create a Button1Click function, if I remove the function it works perfectly fine. So I'm not sure why the function is preventing the loop from executing

1 comment
Apologies for not giving a more thorough explanation. What I'm trying to do is move a model using a Gui Button rather than a click detector, but it seems like the function doesn't detect anything. The answer above also didn't execute but didn't have any errors^