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

Help with Meshes?

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

✓ Accepted answer

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)

1 comment

0

Thanks, I don't know why I didn't think of this

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