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

Can you keep a part up when its not anchored?

I made this cube that spins around but when I try it, It cannot be anchored or else it won't spin, But when I unanchor it, it falls into the void, Can anyone help?

script:

for _, v in pairs(workspace.Cube:GetDescendants()) do
	if v:IsA("BasePart") then
		v.Anchored = false
		local weld = Instance.new("WeldConstraint")
		weld.Part0 = v
		weld.Part1 = workspace.Cube.MainCube
		weld.Parent = v
	end
end

while true do
	wait(5)
	game.TweenService:Create(workspace.Cube.MainCube.BodyGyro, TweenInfo.new(5),{
		CFrame = CFrame.new(workspace.Cube.MainCube.Position + Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1)), game.Workspace.Cube.MainCube.Position)
	}):Play()
end

2 comments

0

How are you handing the spinning?

0

When you try to CFrame anything that's welded, the weld breaks. Don't weld it, hold it up using body forces. Also, when you weld two objects, the offset is NOT conserved the part1 takes the CFramr of part0 so you also have to set the offset manually.

1 answer

✓ Accepted answer

You can make "BodyPosition" pointing to the cube's position with infinite force:

local Cube = workspace.Cube?

local Force = Instance.new("BodyPosition")
Force.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
Force.Position = Cube.Position
Force.P = 5000
Force.D = 50
Force.Parent = Cube

P is described as: Determines how aggressive of a force is applied in reaching the goal position

D is described as: Determines the amount of dampening to use in reaching the goal BodyPostion/Position Position

You can also use CFrame spinning if you do not need the cube's physics for game mechanics.

5 comments

0

Didn't work

0

oh crap it's body position not body velocity, i edited.

0

Did you see the script above?

0

Does the part need to be unanchored? Because if it doesn't have to be anchored you could use something such as Model:SetPrimaryPartCFrame to rotate all parts within a model at once while keeping it anchored, only issue is players cant 'Interact' with the physics of the cube.

0

Yes actually

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