When I Clone and parent a script it does not run

When I clone a script and parent it to a NumberValue, the script does not run.

That is the script I want to clone
image

This is the contents of the script I cloned

repeat wait(0.5) print("waiting") until script.Parent.Name == "padlockequip"

for i = 1,10,1 do

print("In loop")

wait(1)

end

script.Parent:Destroy()

The code I used to clone the script

local Script = scripttoadd:Clone() 
Script.Parent = thething 
Script.Disabled = false

It looks like that in the game
image

Try this:

repeat task.wait() until script.AncestryChanged

for i = 1,10,1 do

print("In loop")

wait(1)

end

script.Parent:Destroy()

No need to disable script.

What’s the path of padlockequip?

What does that mean?-----------------------------------------------------------

The entire path inside the explorer, for example game.Players.Player.Values.padlockequip.

I just checked and no, Scripts and LocalScripts can’t run directly under the player instance. Although Scripts are able to run inside Backpack and LocalScripts inside PlayerGui.

Player scripts are parented to the PlayerScripts folder of the player instance.

That’s correct, I forgot to mention PlayerScripts, although only LocalScripts can run there.