Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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:

script.Parent.OtherSwordOn.OnServerEvent:Connect(function(Player)
	if Player.Character:FindFirstChild("Blade2") == nil then
	local RArmWeld = Instance.new("Weld")
	local Box = script.Parent.Parent.Handle:Clone()
	RArmWeld.Parent = Box
	RArmWeld.Part0 = RArmWeld.Parent
	RArmWeld.Part1 = Player.Character.LeftHand
	RArmWeld.C1 = CFrame.new(0, -0.12, -2.5) *CFrame.Angles(0, math.rad(180),math.rad(90))
	Box.Name = "Blade2"
	Box.CanCollide = false 
	Box.Parent = Player.Character
	elseif Player.Character:FindFirstChild("Blade2") ~= nil then
		Player.Character.Blade2:Destroy()
	end
end)

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

script.Parent.Out.OnServerEvent:Connect(function(Player)
	if Player.NonStats.BusoOn.Value == true then
		local Stick = script.Parent.Parent
		Stick.Handle.TextureID = ""
		Stick.Handle.BrickColor = BrickColor.new("Institutional white")
		Stick.Handle.Material = "Neon"
		Player.Character.Blade2.TextureID = ""
		Player.Character.Blade2.BrickColor = BrickColor.new("Institutional white")
		Player.Character.Blade2.Material = "Neon"
		Player.Character.UpperTorso.Buso:Play()
		wait(0.5)
		local P1 = game.ReplicatedStorage["Buso For Sout oWo"].Steam:Clone()
		P1.Parent = Stick.Handle
		local P2 = game.ReplicatedStorage["Buso For Sout oWo"].Steam:Clone()
		P2.Parent = Player.Character.Blade2
		Stick.Handle.BrickColor = BrickColor.new("Really black")
		Stick.Handle.Material = "SmoothPlastic"
		Stick.Handle.Reflectance = 0.1
		Player.Character.Blade2.BrickColor = BrickColor.new("Really black")
		Player.Character.Blade2.Material = "SmoothPlastic"
		Player.Character.Blade2.Reflectance = 0.1
		game:GetService("Debris"):AddItem(P1, 1)
		game:GetService("Debris"):AddItem(P2, 1)
		wait(0.5)
		if Player.NonStats.BusoOn.Value == false then
		Stick.Handle.TextureID = game.ReplicatedStorage.Swords["Dual Katanas"].Handle.TextureId
		Stick.Handle.BrickColor = BrickColor.new("Burnt Sienna")
		Stick.Handle.Material = "Slate"
		Stick.Handle.Reflectance = 0
		Player.Character.Blade2.TextureID = game.ReplicatedStorage.Swords["Dual Katanas"].Handle.TextureId	
		end
	end
end)
script.Parent.OutOff.OnServerEvent:Connect(function(Player)
	if Player.NonStats.BusoOn.Value == false then	
	local Stick = script.Parent.Parent
	Stick.Handle.TextureID = game.ReplicatedStorage.Swords["Dual Katanas"].Handle.TextureId
	Player.Character.Blade2.TextureID = game.ReplicatedStorage.Swords["Dual Katanas"].Handle.TextureId
	end
end)

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

1 comment

1

It's TextureId?

1 answer

✓ Accepted answer

ok. so why dont u try

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

5 comments

0

can you explain to OP your answer

0

ok

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)

0

Apparently I used TextureId instead of TextureID. Thanks for the help though!

0

o ok

This discussion is preserved as it was. New answers, comments, and votes are closed.