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
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
You get this when you reparent an object inside of an event handler related to hierarchy (ChildAdded, ChildRemoving, AncestryChanged, GetPropertyChangedSignal(“Parent”), etc.) or when the object is destroyed and you are still trying to parent it somewhere.
Are you sure you aren’t doing anything like this? Original thread
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?
Use Random thing and thousands of other assets to build an immersive game or experience. Select from a wide range of models, decals, meshes, plugins, or audio that help bring your imagination into reality.
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…
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.
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)