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

Can someone tell me why this Instance.new for a meshpart script isnt working?


I am creating a game and I want to add a MeshPart using instance.new but we all know that when we create a meshpart using Instance.new is going to put the Id at 0 so I added this under the Instance.new script: part.MeshId = ("694456873") if it was a normal script it would work but I have a bigger script that's why the script (i think) didn't worked. here's the script:

wait(2)
 workspace:WaitForChild("PartStorage")


deb = true  script.Parent.Clicker.ClickDetector.MouseClick:connect(function(wat)
 	if deb == true then
		deb = false
 			local part = Instance.new("MeshPart",workspace.PartStorage)
 			part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
 			part.Material=script.Parent.Parent.Parent.MaterialValue.Value
			part.MeshId = ("694456873")
 			local cash = Instance.new("IntValue",part)
 			cash.Name = "Cash"
 			cash.Value = 1 
 			part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.3,0)
 			part.FormFactor = "Custom"
 			part.Size=Vector3.new(1, 1, 1) 
 			part.TopSurface = "Smooth"
 			part.BottomSurface = "Smooth"
 			game.Debris:AddItem(part,40) 
 			wait(5)
 			deb = true
 	end
 end)

1 comment

0

oops

2 answers

Use code block please. Also Instance.new("IntValue",part) is depecrated.

2 comments

0

I tried to but it didnt worked

0

Its not depreciated, its just slower, a lot slower.

Meshparts are interesting, you can't set their MeshId in-game or by script, it has to be set manually, I'd say your best bet is to make the meshpart and store it in ReplicatedStorage, then just use game:GetService("ReplicatedStorage"):WaitForChild("MeshPartName"):Clone() Or something along those lines.

Also, with the Code Block, you have to highlight your code, and then click the "Code Block" button.

2 comments

0

oh

0

Yeah he is correct just tested it

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