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

How to make a block rotate around your character?

I am trying to make a script (for script builder) that makes a 1x1x1 stud brick revolve around your character, but for some reason, it only makes it rotate. Here is the script:

local player = game:service'Players':FindFirstChild('phriol')
local char = player.Character
local torso = char.Torso

local block = Instance.new("Part",char)

block.Size = Vector3.new(1,.2,1)
block.Material = "Neon"
block.Anchored = true

game:service'RunService'.Stepped:connect(function()
	block.CFrame = block.CFrame:Lerp(torso.CFrame * CFrame.new(0,1,3),.1)
	block.CFrame = block.CFrame:Lerp(torso.CFrame * CFrame.Angles(0,math.rad(30),0),.1)
end)

I tried using Position * CFrame.Angles, but that didn't work out since you can't multiply a Vector3 by a CFrame. Any help would be extremely appreciated.

1 comment

0

I think an easier way to do this is to weld a large pad (like 4x1x4) to your torso and connect the 1x1x1 part to a corner on the pad. Then make the pad transparent and rotate it to give the revolving illusion.

2 answers

while wait() do
	for i = -180,180 do
		Pos = Part.Position
		Rot = Part.Rotation
		Part.CFrame = CFrame.new(Vector3.new(30*math.cos(i),0,30*math.sin(i*-1))+Torso.Position)
	end
end

I would suggest you try something like this. This is converted from the formula of finding a point in a circle. I hope it works, didn't tried it yet.

I'm not sure if this would work, but try making a hingeconstraint between the character and the part.

1 comment

0

Then mess around with the motor properties of the hingeconstraint

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