Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't my meshId change?

I am trying to create a thing so when the block hits a brick it's meshID changes.

local Changeable = game.workspace.Changeable
local Mesh = game.workspace.Changeable.Mesh
script.Parent.Touched:connect(function(obj)
	if obj:FindFirstChild("Changeable") ~= nil then
    Mesh.MeshId = "http://www.roblox.com/asset/?id=79429148"
    Changeable.Name = "RailIn"
  end
end)

2 comments

1

Are you sure you have it right? Do you mean texture? Because you can't upload meshes to ROBLOX as far as I know.

0

I am not trying to upload a mesh. This mesh already exists. Its type is a filemesh though it by default should change to that type. I want to add the texture of the mesh in a later script

1 answer

✓ Accepted answer

First off on line 2, your variable is

local Mesh = game.Workspace.Changeable.Mesh

when you already have a variable to the "Changable" part. Change that variable to:

local Mesh = Changeable:WaitForChild("Mesh")

By doing what is above tells the script not to run until they can verify that there is a mesh in Changeable.

Also, your "if" statement. You asking if there is a part inside the part you touched. To fix this, change it to,

if obj == Changeable  then
	Mesh.MeshId = "http://www.roblox.com/asset/?id=79429148"
	Changeable.Name = "RailIn"
end

Hope this helped

This discussion is preserved as it was. New answers, comments, and votes are closed.