Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make this script only run once after it finds a banknote?

local TeleportPos 

for i,v in pairs(game.Workspace.ItFolder:GetChildren())do
	if v.Name == "Banknote" then
		TeleportPos = v.Handle.Position
	    print(TeleportPos)
	end
end

I was making a gamepass where u can teleport to bank notes but this one PRINts all the postions of the BankNotes Can someone help me?

1 answer

✓ Accepted answer

you just need to add a break, that will stop the loop from running

local TeleportPos 

for i,v in pairs(game.Workspace.ItFolder:GetChildren())do
    if v.Name == "Banknote" then
        TeleportPos = v.Handle.Position
        print(TeleportPos)
        break
    end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.