Can't change texture from parent script (SOLVED)

#1

Hey everyone!

I have a structure like this:
image
And I can easily change texture of that “floor” object with it’s init function, but I have quite a few of objects like this, so I need to change texture from a parent script. But I can’t. It gives “attempt to index global ‘self’ (a nil value)” error on script like:

	go.property("texture", resource.texture("/01.jpg"))
	go.set("/floor#floor", "texture", self.texture)

Obviously I can’t use self property like that, but other options don’t work.

0 Likes

#2

You can use go.get(“some#script”, “some_property”) to get the property of any component (in the same collection).

0 Likes

#3

Thanks! Works perfectly =)

0 Likes