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

Help with Meshes?

Asked by 10 years ago

How can I make this script make exactly 1 Mesh and not multiple Meshes.

Player = game.Players.LocalPlayer
Char = Player.Character
RA = Char["Right Arm"]


function RightArm(Part)
    Mesh = Instance.new("SpecialMesh", RA)
    Mesh.MeshId = "http://www.roblox.com/asset/?id=25212400"
    Mesh.MeshType = "FileMesh"
    Mesh.Scale = Vector3.new(1, 2.05, 1)
    Mesh.TextureId = "http://www.roblox.com/asset/?id=41988084"
    OriginalColor = RA.BrickColor
    RA.BrickColor = BrickColor.new("Light Orange")
    wait(1)
    RA.BrickColor = OriginalColor
    Mesh:Remove()
end

RA.Touched:connect(RightArm)

1 answer

Log in to vote
2
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
10 years ago

You just have to make a check to see if the mesh already exists or not.

Player = game.Players.LocalPlayer
Char = Player.Character
RA = Char["Right Arm"]


function RightArm(Part)
    if not RA:findFirstChild("Mesh") then -- This is the check
        Mesh = Instance.new("SpecialMesh", RA)
        Mesh.MeshId = "http://www.roblox.com/asset/?id=25212400"
        Mesh.MeshType = "FileMesh"
        Mesh.Scale = Vector3.new(1, 2.05, 1)
        Mesh.TextureId = "http://www.roblox.com/asset/?id=41988084"
        OriginalColor = RA.BrickColor
        RA.BrickColor = BrickColor.new("Light Orange")
        wait(1)
        RA.BrickColor = OriginalColor
        Mesh:Remove()
    end
end

RA.Touched:connect(RightArm)

0
Thanks, I don't know why I didn't think of this chill22518 145 — 10y
Ad

Answer this question