Hey! Sorry, I'm terrible at scripting. Basically, I want a character to be holding a brick, and then when that brick comes in contact with another brick, it changes the name and the appearance. This is what I have so far. The name changes but the meshes don't:
function tch(h) if (h.Parent.Name == "Tool") then h.Parent.Name = "Cooked Tool" wait(0.5) h.Parent.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=38963339" h.Parent.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=134430675" end end
script.Parent.Touched:connect(tch)
The problem was you needed to get the players backpack by using GetPlayerFromCharacter
.
script.Parent.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) --Get the player if not player then print("Player not found") else --If we cant find the player, we print that it wasn't found. If we did find the player, we continue on with the script. local Tool = player.Backpack:FindFirstChild("Tool") --Find the tool name if Tool then Tool.Name = "Cooked Tool" Tool.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=38963339" Tool.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=134430675" end end end)
Please accept my answer if this helped!
well I think instead of changing the mesh id you should change the transparency, it will simplify it. so I used a script for a tutorial, and then changed it. this script is for a key door and makes the door open and close, it access the doors transparency. so I changed it to access the items transparency. It was very simple, all you have to do is make a part transparency 1, or 0 and it would work. this script is a server script ( just a normal script ) inside of any part that you want it to happen. I can also access the tools name easily, here is my script.
script.Parent.Touched:connect(function(p) if p.Parent.Name == "Food" then --name of the tool p.Parent.Handle.Transparency = 1 p.Parent.Name = "Test" end end)