Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this armor script not working ?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So i made a script to make an armor but it won't work.

Here's the script :

01local Kagune = script.Parent
02local Character = Kagune.Parent.Parent.Parent.Character
03local K = script.Parent:GetChildren()
04 
05for i=1, #K do
06if K[i].ClassName == "Part" then
07local W = Instance.new("Weld")
08W.Part0 = Kagune.Handle
09W.Part1 = K[i]
10local HP = CFrame.new(Kagune.Handle.Position)
11local C0V = Kagune.Handle.CFrame:inverse()*HP
12local C1V = K[i].CFrame:inverse()*HP
13W.C0 = C0V
14W.C1 = C1V
15W.Parent = Kagune.Handle
View all 25 lines...

Error : 23:58:37.888 - Handle is not a valid member of Model 23:58:37.889 - Script 'Players.Player.Backpack.Kagune.Kagune.Script', Line 8

But Handle is in the model. I don't know why it's gone everytime. Thanks for helping me !

1 answer

Log in to vote
1
Answered by
Edenojack 171
9 years ago

Issue sounds like it's just finding the handle part, which could just be a misspelling, easy to do. This will attempt to find the handle, capitalised or lower case, and if not, print the name of every part in the model. (Some things may be wrong, I'm on a phone atm.) If things still are wrong, print screen the model's expanded view in explorer, upload to imgur/twitter/whatever and comment both the link and what the output says for below.

01local Kagune = script.Parent
02Local Handle = Kagune:findFirstChild("Handle") or Kagune:findFirstChild("handle)
03    local Character = game. Players. LocakPlayer.Character
04    local K = Kagune:GetChildren()
05    for i=1, #K do
06    if K[i].ClassName == "Part" and Handle then
07    local W = Instance.new("Weld")
08    W.Part0 = Handle
09    W.Part1 = K[i]
10    local HP = CFrame.new(Handle.Position)
11    local C0V = Handle.CFrame:inverse()*HP
12    local C1V = K[i].CFrame:inverse()*HP
13    W.C0 = C0V
14    W.C1 = C1V
15    W.Parent = Handle
View all 27 lines...
0
Thank you ! Now it works, i only needed to add Handle = script.Parent:FindFirstChild("Handle"). haloelite27 25 — 9y
Ad

Answer this question