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

Easy brick script right?

Okay, So i have created a script for a brick to follow me , exactly behind my torso. using this loop function : while true do wait(0.005) brick.CFrame = Body.CFrame - Body.CFrame.lookVector * 1.5 brick.CFrame = Body.CFrame - Body.CFrame.lookVector * 1.5 end

It follows me, that part works. But how would I incorporate a hovering (up and down) addition into it, so that it follows me AND has that sweet animation that I ever so desire?

2 comments

0

Use another script..

0

Use a code block please...

1 answer

✓ Accepted answer

First, I see you are using a loop to set the part's position manually. This works, but not very well as it jitters. A better solution would be to use a weld, like so (assuming you are using the same variables):

Weld = Instance.new("Weld", Body)

Weld.Part0 = Body
Weld.Part1 = brick

Weld.C0 = CFrame.new(0, 0, 1.5)

To do the animation, you can use a sine wave, like so:

local Wave = 0

while true do
	Weld.C1 = CFrame.new(0, math.sin(math.rad(Wave)), 0)	
	
	Wave = Wave + 10 -- Increase number to increase speed.
	
	wait()
end

Hope this helps.

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