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 8 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 :

local Kagune = script.Parent
local Character = Kagune.Parent.Parent.Parent.Character
local K = script.Parent:GetChildren()

for i=1, #K do
if K[i].ClassName == "Part" then
local W = Instance.new("Weld")
W.Part0 = Kagune.Handle
W.Part1 = K[i]
local HP = CFrame.new(Kagune.Handle.Position)
local C0V = Kagune.Handle.CFrame:inverse()*HP
local C1V = K[i].CFrame:inverse()*HP
W.C0 = C0V
W.C1 = C1V
W.Parent = Kagune.Handle
end
local W2 = Instance.new("Weld")
W2.Part0 = Character.Torso
W2.Part1 = Kagune.Handle
W2.C0 = CFrame.new(0, 0, 0)
W2.Parent = W2.Part0
K[i].Anchored = false
K[i].CanCollide = false
K[i].Parent = Character
end

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
8 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.

local Kagune = script.Parent
Local Handle = Kagune:findFirstChild("Handle") or Kagune:findFirstChild("handle)
    local Character = game. Players. LocakPlayer.Character 
    local K = Kagune:GetChildren()
    for i=1, #K do
    if K[i].ClassName == "Part" and Handle then
    local W = Instance.new("Weld")
    W.Part0 = Handle
    W.Part1 = K[i]
    local HP = CFrame.new(Handle.Position)
    local C0V = Handle.CFrame:inverse()*HP
    local C1V = K[i].CFrame:inverse()*HP
    W.C0 = C0V
    W.C1 = C1V
    W.Parent = Handle
    Else
Print(K[I].Name) --if the handle can't be found, prints name of all existing parts.
    end
    local W2 = Instance.new("Weld")
    W2.Part0 = Character.Torso
    W2.Part1 = Handle
    W2.C0 = CFrame.new(0, 0, 0)
    W2.Parent = W2.Part0
    K[i].Anchored = false
    K[i].CanCollide = false
    K[i].Parent = Character
    end

0
Thank you ! Now it works, i only needed to add Handle = script.Parent:FindFirstChild("Handle"). haloelite27 25 — 8y
Ad

Answer this question