So I have this very simple script, which just moves a part up and down in a linear pattern, kinda like hovering. My problem however, is that it goes too far up and too far down (as shown in the video). I am wanting to make it move about half or less than half as far as it is currently, but I don’t understand math very well, and can’t figure out how to shorten the sine waves. I have searched all over the forums for solutions but couldn’t find anything, so anything helps.
Here is my code:
local part = script.Parent
local startpos = part.Position
while (true) do
wait()
part.Position = startpos + Vector3.new(0,math.sin(tick()),0)
end
dividing the result of math.sin() by a number >1 will lower the distance travelled
multiplying it by a number >1 will increase the distance travelled
Similarly
dividing the tick() by >1 will make the wave go slower
multiplying it by >1 will make it go faster
You can experiment with it on desmos by adjusting the m and n sliders: Graphing Calculator
(see what happens when you change n from 1 to 2, like the previous reply suggested)