How exactly can i do this?
I want to change the transparency of something inside a two word model, but I'm not sure how to
script.Parent.Touched:connect(function(hit) script.Parent.Parent.Parent.(idk).Head.Transparency = 0 ^^^^ Thats where the model is end)
In my opinion, the best way to identify two word models is with FindFirstChild
, because the child you are identifying is always in quotation marks. Using this technique, you can identify models with as many words as you want, though I would try to keep it reasonable. Another option would be to use brackets, which you can also put quotation marks into. Again, you can use this with as many words as you want. Both of these methods will work the same way. It is up to you to decide which one is best for your game. Good luck! Here is your example, modified both ways:
Option 1:
script.Parent.Touched:connect(function(Hit) script.Parent.Parent.Parent["Multiple Word Model"].Head.Transparency = 0 end)
Option 2:
script.Parent.Touched:connect(function(Hit) script.Parent.Parent.Parent:FindFirstChild("Multiple Word Model").Head.Transparency = 0 end)
Instead of using the '.' operator, you will make use of "[]" one instead. For example, let's say your model is named "My Model", then your code will become the following:
script.Parent.Touched:connect(function(hit) script.Parent.Parent.Parent["My Model"].Head.Transparency = 0 end)