Simple dropper script anchoring dropped blocks

I was working on a script which imitates a dropper (like in a tycoon game), but for some reason the new parts are anchored after the first new part. Like, to further explain, the first part it ever drops is unanchored, which I want, but every part dropped after that one is anchored for some reason. All help is appreciated!

local part = script.Parent

local function spawnPart()
	local newPart = Instance.new("Part")
	newPart.Parent = game.Workspace
	newPart.Anchored = false
	newPart.Size = Vector3.new(.5,.5,.5)
	local offset = Vector3.new(0, -1, 0)
	newPart.CFrame = part.CFrame + offset
end

while true do
	spawnPart()
	wait(5)
end

2 Likes

Possibly Roblox is automatically anchoring your parts as you down then because your setting the position. Possibly we could delay the anchor after setting the position. Like this:

local part = script.Parent

local function spawnPart()
	local newPart = Instance.new("Part")
	newPart.Parent = game.Workspace
	newPart.Size = Vector3.new(.5,.5,.5)
	local offset = Vector3.new(0, -1, 0)
	newPart.CFrame = part.CFrame + offset
        wait(0.001)
        newPart.Anchored = false
end

while true do
	spawnPart()
	wait(5)
end
1 Like

I couple of things:

  • When creating an Instance, the First thing you should do is apply the properties, and then Parent the Object.

  • use task.wait() instead of wait(), task.wait() is faster and more accurate than wait()

This isn’t true, It never has been true, I wonder who told you this.

1 Like

I applied all the things you said, which seemed like they definitely should have worked, but to no avail. Maybe its something to do with a plugin I own or something deeper like that? I’m not too sure.

Have you checked console for errors? Maybe create a print to tell what the object anchored is true or false at the beginning of the game

I could try that now, it seems possible that a print could help a little

Parts automatically have the Anchored Property set to false, what you are saying will not help the OP with what he is doing.

@watsup1087
If you are referring the Momentary pause in the Air, that has to do with something called Network Ownership which has nothing to do with a Part being anchored

Well, that’s not my problem unfortunately. I go into a test play and when I view the parts properties anchored is true in all but the first part that dropped. And also, I created the script, so there should be no reason that Network Ownership would have an impact on the way it works.

I was just attempting to check what is happening to the object.

I made sure to test with this code:

function SpawnIn()
	
	local P = Instance.new("Part")
	P.Size = Vector3.new(.5,.5,.5)
	local offset = Vector3.new(0, -1, 0)
	P.CFrame = workspace.P1.CFrame + offset
	
	P.Parent = workspace
	
	
end

while true do
	
	SpawnIn()
	
	task.wait(.5)
end

Works fine.

  • Anchored Defaults to false
  • Size works

It does

When playing the game, You can notice a Stutter of the Physics as the Owner is applied to the Server, You set it to the Player if they own it, or the other way around.

1 Like

Well now I know for a fact that it has something to do with another script in the game or a plugin because your code did the exact same thing in my baseplate as my original code was doing. Thanks for checking in your own baseplate, I’ll just have to try in a new baseplate and if the issue continues I’ll just have to see about some of my old plugins.

Plus, can you send a Video of what you mean?

Absolutely, give me like a couple minutes though i dont screen record often

You can’t see the properties menu unfortunately but you’ll just have to take me on my word that the first like 3 blocks that drop are unanchored but the rest afterwards arent.