Is this a bug or is it my script?

Hello, today i encountered a weird script’s behavior, basically if i don’t put a print function the script won’t work. This is my script that doesn’t work:

if equippedItem then
	for i, v in pairs(equippedItem) do
		player:WaitForChild("EquippedItem").Value = v
					
		local cloned = game.ReplicatedStorage.Items:FindFirstChild(v):Clone()
		cloned.Parent = player.Backpack
	end
end

This is the script with the print function that works:

if equippedItem then
	for i, v in pairs(equippedItem) do
        print("Working")
		player:WaitForChild("EquippedItem").Value = v
					
		local cloned = game.ReplicatedStorage.Items:FindFirstChild(v):Clone()
		cloned.Parent = player.Backpack
	end
end

This is really weird and i don’t understand why this happens, do you have any idea?

The code only works when you have a print statement? As in everything except the print runs only when a print is present?

It’s impossible since a print statement, we’ll just prints things in the output. So the codes probably broken somewhere or it’s a really weird glitch.

Yes it works only with the print function, the rest of the code works because it is in the if statement

This happens only when i try to put objects in the backpack

all print does is print whatever is inside to the output, it doesn’t activate anything…

I know that, it’s for it that i think it is a bug

This is probably a bug because I doubt putting a print function helps running a script. That is really weird. Does it have to be a print function or can it be something like a note?