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

"TexureID is not a valid member of MeshPart. Blade2 is not a valid member of model" (but they are)?

Asked by
soutpansa 120
6 years ago

So I've got a script that is supposed to change the TextureID and material of a Part that is in the player when a tool is equipped, but it just gives me the errors in the title of the question. If I add a wait(2), it works, but I can't afford to make it wait to change the part. The part is put into the character with a script when the player equips a tool.

Here's the script that inserts the part:

01script.Parent.OtherSwordOn.OnServerEvent:Connect(function(Player)
02    if Player.Character:FindFirstChild("Blade2") == nil then
03    local RArmWeld = Instance.new("Weld")
04    local Box = script.Parent.Parent.Handle:Clone()
05    RArmWeld.Parent = Box
06    RArmWeld.Part0 = RArmWeld.Parent
07    RArmWeld.Part1 = Player.Character.LeftHand
08    RArmWeld.C1 = CFrame.new(0, -0.12, -2.5) *CFrame.Angles(0, math.rad(180),math.rad(90))
09    Box.Name = "Blade2"
10    Box.CanCollide = false
11    Box.Parent = Player.Character
12    elseif Player.Character:FindFirstChild("Blade2") ~= nil then
13        Player.Character.Blade2:Destroy()
14    end
15end)

This script works fine for some reason. ^

These next 2 scripts give the errors. I've tried changing them to :FindFirstChild(), but then the script simply doesn't work

01script.Parent.Out.OnServerEvent:Connect(function(Player)
02    if Player.NonStats.BusoOn.Value == true then
03        local Stick = script.Parent.Parent
04        Stick.Handle.TextureID = ""
05        Stick.Handle.BrickColor = BrickColor.new("Institutional white")
06        Stick.Handle.Material = "Neon"
07        Player.Character.Blade2.TextureID = ""
08        Player.Character.Blade2.BrickColor = BrickColor.new("Institutional white")
09        Player.Character.Blade2.Material = "Neon"
10        Player.Character.UpperTorso.Buso:Play()
11        wait(0.5)
12        local P1 = game.ReplicatedStorage["Buso For Sout oWo"].Steam:Clone()
13        P1.Parent = Stick.Handle
14        local P2 = game.ReplicatedStorage["Buso For Sout oWo"].Steam:Clone()
15        P2.Parent = Player.Character.Blade2
View all 33 lines...
1script.Parent.OutOff.OnServerEvent:Connect(function(Player)
2    if Player.NonStats.BusoOn.Value == false then  
3    local Stick = script.Parent.Parent
4    Stick.Handle.TextureID = game.ReplicatedStorage.Swords["Dual Katanas"].Handle.TextureId
5    Player.Character.Blade2.TextureID = game.ReplicatedStorage.Swords["Dual Katanas"].Handle.TextureId
6    end
7end)

Thanks for reading! I really need some help with this because it's delaying a feature x.x

1
It's TextureId? User#19524 175 — 6y

1 answer

Log in to vote
3
Answered by 6 years ago
Edited 6 years ago

ok. so why dont u try

1(item):FindFirstChild("(itemchildname)") or (item):WaitForChild("(itemchildname)")

basically if the script fails to find the child(maybe it has not loaded in or what not) then it will call wait for child. calling wait for child by itself might not be good enough(maybe it has already loaded in or what not) and vice versa if u call find first child by itself.

0
can you explain to OP your answer User#19524 175 — 6y
0
ok TheluaBanana 946 — 6y
0
I used WaitForChild, now it isnt giving me an error for Blade2 anymore. It's giving me an error on the last script at line 4. Apparently TextureID isnt a valid member of MeshPart (Stick is the handle of the tool, which is a meshpart) soutpansa 120 — 6y
0
Apparently I used TextureId instead of TextureID. Thanks for the help though! soutpansa 120 — 6y
0
o ok TheluaBanana 946 — 6y
Ad

Answer this question