this line of code is inside of while loop which in this case only runs once
repeat task.wait() until (playerposition - chosenblock.Position).Magnitude <= 10 do
print("e")
end
nothing happens when the magnitude is 10 or less
this line of code is inside of while loop which in this case only runs once
repeat task.wait() until (playerposition - chosenblock.Position).Magnitude <= 10 do
print("e")
end
nothing happens when the magnitude is 10 or less
Maybe this helps.
local db = false -- Debounce
player.HumanoidRootPart.Changed:Connect(function() -- This will fire everytime player moves.
if (playerPosition - choiceBlock.Position).magnitude < 15 and not db then
db = true
print("Print")
wait(0.1)
db = false
end
end)
No, I don’t think that helps, I need it to be a repeat until
What are you expecting to happen? what is actually happening? You may be assuming the do is part of the loop but it isn’t; you are just declaring a separate scope. With proper indentation your code looks like this
repeat
task.wait()
until (playerposition - chosenblock.Position).Magnitude <= 10
do
print("e")
end
This will wait until the player is within 10 studs, then print e once.
That’s because it’s not how you use repeat 
Repeat works like a while loop, you put the code its supposed to execute after the repeat keyword, then you put the “until” part. (which doesn’t have a do keyword btw)
Here’s what your code should actually look like:
repeat
task.wait()
print("e")
until (playerposition - chosenblock.Position).Magnitude <= 10
what kind of wait until something is something function should I use then
if you want to wait until the player is close to the chosen part then the issue isn’t with the repeat until, it’s with the variable declaration. When you create local playerposition it saves it forever and it will not change unless you do so in the script. Try this
repeat
task.wait()
until (player.Character:GetPivot().Position - chosenblock.Position).Magnitude <= 10
do
print("e")
end
This will error if the player dies, you can add this into a CharacterAdded connection if need be.
repeat task.wait() until (playerposition - chosenblock.Position).Magnitude <= 10
print("e")