I would like a way to rotate something back and forth very efficiently and smooth such as: https://gyazo.com/ce2763e854e1ab7ce923885591125d31
I can't seem to figure out how to do this (I'm sure I am over thinking this).
--Things that you can change have been marked by * local TweenService = game:GetService("TweenService") --Get Tween Service local Gui = script.Parent --*The gui that we want to tween local goal1 = { Rotation = 10 --*The Property Goal we want to change } local goal2 = { Rotation = -10 --*The reverse of Goal1 } TweenTime = 2 --*The length of the tween local tweenInfo = TweenInfo.new(TweenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut) --Create a tweeninfo (TweenTime, Style, Direction) local tween1 = TweenService:Create(Gui, tweenInfo, goal1) --Create the first tween (using properties goal1), (Instance, TweenInfo, Goal) local tween2 = TweenService:Create(Gui, tweenInfo, goal2) --Create the second tween (using properties goal2) spawn(function() --so code after this can run while true do --create a loop tween1:Play() --Play the first tween wait(TweenTime) --wait until the tween has finished tween2:Play() --do the second tween wait(TweenTime) --wait until second tween has finished end end)
This should work if you put the local script inside of the guiobject or change the variable to where the gui is located
Use sine wave
part = script.Parent x = 0 while wait() do y = 1*math.sin(x) -- change 1 to how high you want the sin wave to go on y axis part.CFrame = part.CFrame * CFrame.Angles(0,0,math.rad(y)) x = x + 0.1 end
Just make sure script is inside the part, and i think this will work