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

Part.Anchored = false doesn't work?

Asked by 3 years ago

I'm currently learning basics of scripting and I came across Instance.new

local Part = workspace.Part

Instance.new("Part")
Part.Anchored = false
Part.BrickColor = BrickColor.new("Dark green")
Part.Position = Vector3.new(0,100,0)

Apparently, Part.Anchored = false doesn't work because the part stays anchored

2 answers

Log in to vote
2
Answered by 3 years ago
Edited 3 years ago

Because you have 2 Parts in workspace, and you make the script confused so what the script does it chooses 1 part to be un-anchored. Try naming the other part to something like Part2.

You got another part due to Instance.new("Part") without naming it, leaving the name to Part.

Hope this helps, if this does please accept this answer and upvote. Thank you.

0
Now it says that Part is not valid member of workspace ScrewedPower 33 — 3y
1
Can you show me the script? Gabe_elvin1226aclan 323 — 3y
0
Put the part in the workspace CRAZYQUACKY84 113 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

The part is never created because you never gave it a Parent.

When you use Instance.new() you should always assign a Parent to the Instance. It's usually best to leave this for last and allow the other properties of the Instance to come first. If you fail to give the Instance a parent it will float around in thin air.

Also, when you are using the constructor, Instance.new() returns the created Instance, and thus you'd have to assign it to a variable. Without assigning it to a variable the compiler will have no idea what you're referring to.

Going to this: "because you have 2 Parts in workspace". The second part was never given a parent. If your initial idea was to edit the newly created part, then parent that new part to the Workspace and give it a different Name so it doesn't get confused with other Instances called Part.

Answer this question