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

How do I make an object spin while orbiting a player?

I have this script here:

i = 0
dist = 5
spd = 0.0125
angle = 0
this = script.Parent
orbiting = script.Parent.Parent.Torso
while true do 
i=i+1 
wait() 
this.CFrame = orbiting.CFrame*CFrame.fromEulerAnglesXYZ(angle,i*spd,0)*CFrame.new(0,0,dist) 
end

And along with this script, I have another part working in tandem to put the parent of this script into the player upon enter, making an orbiting block.

Is there a possible way to add a part where it makes the brick not only orbit you, but spin while doing so? An example of what I mean would be say, in Mario Kart. The green koopa shells orbit you, but also spin while doing so. I would like that kind of effect, but I can't seem to get my head to think of a way to do it. Please, help?

1 answer

Insert a BodyAngularVelocity inside the object.

4 comments

0

Would the object have to be unanchored, because it's anchored.

0

Indeed @Auto2359

0

For the object to be able to orbit, it needs to be anchored, so it doesn't glitch around and bounce. Is there another way that it could spin while anchored? I know there are spin scripts, but I can't seem to combine my script and the spin scripts I found.

0

p.CFrame = p.fromEulerAnglesXYZ + Vector3.new(0,0,1) Throw that inside a loop

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