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

Why won't my meshId change?

Asked by 8 years ago

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)
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. TheDeadlyPanther 2460 — 8y
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 Conmmander 479 — 8y

1 answer

Log in to vote
0
Answered by
Unlimitus 120
8 years ago

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

Ad

Answer this question