Make a "Flutuating" Item

  1. What do you want to achieve? I Want to make a item that will be Flutuating, something like this:
    End_Crystal
    I want it to rotate and move on all axis

  2. What is the issue? I don’t know how to limit the mouvement, I tried to put a magnitude and whenever the magnitude was >1,25 the item will return to the original location but isn’t possible to use magnitude with Cframe

  3. What solutions have you tried so far? Well I tried to check on the devforum but I guess my question Is too specific.

1 Like

You can try using a sine wave for that “oscillating” effect, maybe this can guide you:

1 Like

Thanks, I research what’s a sine wave but I dont know
How to implement it, theres no way to make a tween service on the cfram and whenever the cframe surpasses the distance it will return?

To implement it, you set the Cframe’s y position to itself + the sin wave.

local partCFrame = script.Part.CFrame

--math stuff
local speed = 0.1
local angle = 0
local height = 1 -- 

-- starts the infinite loop here to create the animation
while true do
	angle = angle + speed 

	task.wait() -- wait() also works, of course

	if angle >= (math.pi * 2) then
		angle = 0
	end
	--this sets the position to the old Y position *plus* the wave
	script.Part.CFrame = CFrame.new(partCFrame.x, partCFrame.y + math.sin(angle) * height, partCFrame.z)

end

I’m not too sure if this works but I hope you get the idea at least

I thank you for the help, but I want it to move on all the axis, or the wave also works on the others axis?

You want something like this?
https://gyazo.com/c2f2720cd2a962669f8a8a879633bc41

Yes, if possible thats also moves on the others axis.