Good evening! For the past few days i’m working on my own Weapon Engine. And after making sure that everything is supposedly bug-free, i faced a really strange problem during public testing of Weapons.
During the testing in-game, outside the studio, after Character Reset one of the weapons could break in a very strange maner - It returned an error of:
Neck is not valid member of Character.Torso
Which is really strange, considering the fact that both of the weapons use exactly the same script, work in exactly the same maner and built by exactly the same.
PART 1: MAYBE THAT’S REPLICATION PROBLEM AND SLOW LOADING?
I thought it could be a replication issue, maybe first gun loads too fast, before Roblox creates Neck joint, so instead of
local ONeck = Character.Torso.Neck.C0
i made
local ONeck = Character.Torso:WaitForChild("Neck").C0
and even added “repeat task.wait() until script.Parent.Parent:IsA(“Model”)”, so script doesn’t load before it gets inside of the character (For the note: other gun works perfectly fine and everything works in studio with no issues).
And oh well, this time i got the:
Infinite yield possible on ‘Character.Torso:WaitForChild(“Neck”)’
PART 2: WHAT’S GOING ON HERE?!
I tried adding more delays, more check ups and this issue didn’t go away. I was still getting same error after random Character Reset… Out of curiosity i added this line after all the check ups.
for _, v in ipairs(Character.Torso:GetChildren()) do
print(v.Name)
end
And oh lord, that’s what iv’e seen:
It doesn’t see any Instances of Motor6D type! Even the “Tool Weld”, the joint its literally holding attached on at the moment.
PART 3: ANSWERING ON FEW QUESTIONS
Q: Are you sure scripts are identical?
- Yes. They’re being automatically injected into each gun after server start up, so there’s no need to inject them manually and modify every gun after code changes.
Q: Have you tried to inject scripts manually? Maybe your automatic injection doesn’t work properly.
- Yes, i tried and iv’e seen some changes! Good news: It detected “ToolWeld”; Bad news: It still doesn’t detect rest of Motor6D parts.
Q: Have you asked other people about this issue, and have you tried to look up similar topics before creating this one
- Yes. I asked every coding wizard out of my friends, some of them have way more experience than i do and they never faced such an issue. I tried to look up similar topics but haven’t found anything similar.
Q: Where’s LocalScript placed?
- Inside of the gun.
Q: Client issue? Maybe memory leak?
- No. I was launching tests with Microprofiler and Performance stats, everything is fine.
P.S: While writing all of this, i launched another test and this issue just… Disappeared. I used Reset Character for few dozens of times and nothing happened. Scripts were manually loaded into the tools. Surprised, i tried to enable automatic injecting and it appeared again, after random reset, scripts stops seeing Motors (And after random reset, it works like intended(???)). Once again, loaded scripts manually in the Tool and… Issue didn’t disappear. Maybe i got lucky first time, who knows.
Im writing it in Script Support, but i might be wrong and should choose other category, because i think that’s issue on Roblox side. Please correct me if im wrong