How to get Material Variant via Raycast?

I don’t see a single person create post like this anywhere

I tried get raycast Instance but there is no MaterialVariant Property

I believe you haven’t found anything useful because your post doesn’t make sense.

Ok I changed the topic now
How to get Material Variant via Raycast?

local Raycast = workspace:Raycast(...)
if Raycast then
	print(Raycast.Instance.MaterialVariant)
end

?

I already told you so in the topic.

All BaseParts have a MaterialVariant property. What you’re doing is either not checking if the raycast has a result or you’re just using the MaterialVariant property itself, not the actual MaterialVariant (it is a string)

1 Like

Yeah you are right. But the meteraialVariant being a string is trash :sob: why did they even do that

It’s definitely for performance, otherwise they’d use an Object datatype just like the Parent property.

1 Like