So I am not the best at scripting but not too bad either and I am a bit confused why when I clone the script then destroy it it copies the wrong script more context: I am making a simulator where you can buy clones but I just cant get my head around how tags work so basically this script is in a dummy something the clone will kill but I don't know how to use tags so I make it clone itself then destroy itself can someone please tell me if this will work and if it wont what's the problem?
> `local Humanoid = script.Parent.Humanoid
function Dead()
local clone = script.Parent.Parent.Parent.Folder:GetChildren()
for _, v in pairs(clone) do
local name = v.Name
local plr = game.Players:FindFirstChild(name)
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + game.ServerStorage["CloneVal's"].CashVal.Value
plr.leaderstats.Kills.Value = plr.leaderstats.Kills.Value + 1
local scriptclone = script:Clone()
scriptclone.Parent = script.Parent
scriptclone.Name = "MoneyScriptClone"
scriptclone.Disabled = false
script:Destroy()
end
end
Humanoid.Died:Connect(Dead)
`
so basically there is a script (the script above) in a folder in workspace that gets copied into this dummy that a clone of the player would kill and each time it gives the player money so I have to find the clones name then find it as a player then give the player leaderstats but I have recently figured out that it will only work once because the humanoid or character resets and the best way is to use tags but I cant get my head around them so I make the script destroy itself after cloning itself but instead what it does is clones the script to make it respawn but what makes me think it is a glitch is that it keeps cloning the wrong script when the dummy dies even though the script that clones itself is gone and it cant be cloned by the script that gets cloned in the first place because it is deactivated and only the clone gets activated.
all help is appreciated

4 comments
I will try that
It didn't work. The variable name is "scriptclone" and I changed it to "clone2" and nothing changes.
I might've been a bit unclear. You should call the variable in the script something different. So instead of having a variable named 'script' you could use 'script2'. The one on line 9 which is just called 'script'
The script I want to clone is the script that runs it but instead it clones the wrong script. I might just change it so instead of using script I will actually get it from game.Workspace