What is happening

Okay heres the problem, i dont think i need to explain it any further


this is the line of script in question

it is a cloned model, but it doesnt get cloned with a parent (because when i DO force it to have a parent i get this error)

Also, the script works the first time, its the second time and beyond that mess up

this is the snippet of code in question, a bit confined so i dont have to make multiple screenshots
this is for the second error

the object in question gets deleted after that stuff has fulfilled its purpose, again one time, then never again for some reason

1 Like

Can you show more of your code? Itā€™s hard to understand the big picture without more context.

thats the problem, thats pretty much all of the code, the rest related to this is just
Weight1 = (weightDirectoryHere):Clone()
at the beginning of the function

I remember something related to deleting an object directly after it was parented causing the first error

added extra info, your deletion theory should be debunked with it :stuck_out_tongue_winking_eye:

1 Like

Are you sure you arenā€™t doing anything like this? Original thread here

im very sure, i have actually seen the thread/topic beforeā€¦ thats why i created this one

Strange. There is very little code for us to go off. Are you able to create a repro?

this should contain the faulty, or broken script, should i have done something wrong, i have tested if the rest of the script breaks it, and it does not, so im quite actually bamboozledā€¦

1 Like

Itā€™s important to localize your variables, and use clean code so that others can read. Indentations can be useful in allowing one to read the structure of your code.
I couldnā€™t replicate any error. Here is the script that I cleaned up for you.

	local Weight1 = script.Parent.Weight1:Clone()
	Weight1.Parent = plr.Character
	Weight1:SetPrimaryPartCFrame(plr.Character.RightHand.CFrame + (plr.Character.RightHand.CFrame.upVector*-.2))
	Weight1.Handle.WeldConstraint.Part1 = plr.Character.RightHand

This article may help you in creating cleaner code. https://developer.roblox.com/articles/Writing-Clean-Code

im terribly sorry about the mess i call ā€˜organizationā€™ pardon me for that, as for the localizationā€¦ thanks, thats the second time this has happened to me now, i really should get more used to that

(i really hate how i miss the most obvious solutions lately)