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

"Model is not a part of model" error? [UPDATED]

Asked by 8 years ago

So, I have this script which goes into Backpack, it is a normal script. It is meant to detect if you have a certain tool in your backpack, if you do, a part is visible, if you don't, it's not.

The model is inside the Player inside the Workspace, it is called BTorso.

while wait(.01) do
    if script.Parent.Parent.Backpack:FindFirstChild("TASER X26") == nil then
        game.Workspace[script.Parent.Parent.Name].BTorso.TaserA.Transparency = 1
        game.Workspace[script.Parent.Parent.Name].BTorso.TaserB.Transparency = 1
        game.Workspace[script.Parent.Parent.Name].BTorso.TaserC.Transparency = 1
        ------------------------------------------------------------------------
    elseif script.Parent.Parent.Backpack:FindFirstChild("TASER X26") ~= nil then
        game.Workspace[script.Parent.Parent.Name].BTorso.TaserA.Transparency = 0
        game.Workspace[script.Parent.Parent.Name].BTorso.TaserB.Transparency = 0
        game.Workspace[script.Parent.Parent.Name].BTorso.TaserC.Transparency = 0
        ------------------------------------------------------------------------
    end
    ----------------------------------------------------------------------------
    if script.Parent.Parent.Backpack:FindFirstChild("Handcuffs") == nil then        
        game.Workspace[script.Parent.Parent.Name].BTorso.CuffsA.Transparency = 1
        game.Workspace[script.Parent.Parent.Name].BTorso.CuffsB.Transparency = 1
        ------------------------------------------------------------------------
    elseif script.Parent.Parent.Backpack:FindFirstChild("Handcuffs") ~= nil then
        game.Workspace[script.Parent.Parent.Name].BTorso.CuffsA.Transparency = 0
        game.Workspace[script.Parent.Parent.Name].BTorso.CuffsB.Transparency = 0
    end
end

I also get another error with the same effect, which is meant to make a part once again transparent.

local P = script.Parent.Parent.Parent.Parent.Parent.Name
local HLoc = Workspace:FindFirstChild(P)
wait(1)
local Helmet = HLoc:findFirstChild("Face")
local on = true

if Helmet ~= nil then
    script.Parent.MouseButton1Down:connect(function()
        if on == true then
            Helmet.Cap.Transparency = 0
            on = false
        elseif on == false then
            Helmet.Cap.Transparency = 1
            on = true
        end
    end
end)

UPDATE So, it works in studio, but not client. God damn do I hate those errors!

What it's meant to do Function 1: When you equip the TASER X26, inside your player there is BTorso and 3 parts called TaserA, TaserB and TaserC, they should go transparent. When you unequip these, they go opaque again.

Function 2: When you equip the Handcuffs, inside your player there is BTorso and 2 parts called CuffsA and CuffsB they should go transparent. When you unequip these, they go opaque again.

And yes, the system I use works in studio. Not client. It produces an error of

BTorso is not a valid member of Model.

1 answer

Log in to vote
-1
Answered by 8 years ago

Well what is -local P = script.Parent.Parent.Parent.Parent.Parent.Name there can be multiple scripts with parents. I would try script.Parent.Workspace.etc(define child) if that doesn't work, then I would basically select the script (not double clicking) and then go to properties and then name the script and then the line would be-

local P = game.Workspace.(name)

I hope that works, Sammy52520

0
script means the script itself btw, and parent means the script's parent. Not a random script. TheHospitalDev 1134 — 8y
Ad

Answer this question