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

So i need help i cant find any way to change a mesh when touching a brick, can you guys help me?

Asked by 5 years ago

I really need help i cant find any Evnts Functions Or anything at all! to change the mesh of a brick when you touch it

1 answer

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
5 years ago

This is pretty simple what you are asking for.

local Part = script.Parent -- put script in part (server script).
local Players = game:GetService('Players')

Part.Touched:Connect(function(otherPart)
    local Player = Player:GetPlayerFromCharacter(otherPart.Parent)
    if Player then -- check if the part touching is a player
        if Part:FindFirstChildOfClass('SpecialMesh') == nil then -- checks if no mesh
            local Mesh = Instance.new('SpecialMesh')
            Mesh.MeshType = Enum.MeshType.FileMesh
            Mesh.MeshId = 'rbxassetid://0' -- change 0 to your mesh id
        end
    end
end)
Ad

Answer this question