Need help with indexing my mesh part

I’m trying to index Rice Bowl

It works like this

	self.Meshpart["Rice Bowl"].Position = self.Position

but it doesn’t work like this

--Ingr1 is a string thats equal to "Rice Bowl" 
function ricecooker:PromptMessage(player, Ingr1, Ingr2)
	self.Meshpart.Ingr1.Position = self.Position -- Errors here

I fixed it, I used this instead

local RiceBowl = self.Meshpart:WaitForChild(Ingr1)

RiceBowl.Position = self.Position

Try changing it to
self.Meshpart[Ingr1].Position = self.Position
… because Ingr1 is a parameter, not a fixed element in array

1 Like

Unless you definitely need to wait for it to be added, I recommend using FindFirstChild instead.


Why do parameters not work? 30 chars