Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to Change a VertexColor of a Mesh in Lua?

Asked by 8 years ago

How might I change a VertexColor of a Mesh in Lua? My variable is named mesh. I tried this: mesh.VertexColor = (0,0,1)

But it didn't work.

0
VertexColor is a Vector3 color value. This means you need to define the VertexColor with Color3.new() and the RGB colors from 0 to 1. Such as 100/255 or .9 M39a9am3R 3210 — 8y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

Like M39a9am3R said, VertexColor is a Vector3 value, and must be assigned like so:

mesh.VertextColor = Vector3.new(0, 0, 1)


Note that Color3s and Vector3s are fundamentally the exact same thing, they just have slightly different methods and applications. Meshes predate Color3, which is why they use Vector3 instead.

0
IT didnt work! IBuildOn 15 — 8y
0
Did VertexColor not change, or did the change have no effect? Those are two different things. adark 5487 — 8y
0
Well without the script the mesh was yellow, and I put in the vertex color to blue yet it is still yellow. IBuildOn 15 — 8y
0
Did the property change, though? It doesn't always work. adark 5487 — 8y
View all comments (2 more)
0
It worked IBuildOn 15 — 8y
0
If the property changed but the mesh didn't change color - there's nothing you can do, that's a ROBLOX bug. adark 5487 — 8y
Ad

Answer this question