What do you want to achieve? a wing flapping effect using attachments and particles
What is the issue? I don’t know how to make it continuous or if it’s even possible.
What solutions have you tried so far? I’ve tried to make a script (the one below) but it didn’t work
All help is appreciated :>
here’s the code:
local attachment = script.Parent
while true do
for count = 1,5 do
attachment.Orientation += Vector3.new(0,4,0)
end
wait(0.1)
for count = 1,5 do
attachment.Orientation -= Vector3.new(0,4,0)
end
end
Can use tween service for this or you have use a stepped sin wave to control the rotation of the attachment.
I would probably use the TweenService method as all you need is one line of code to run it all.
local TweenService = game:GetService("TweenService")
local TweenInformation = TweenInfo.new(
1,
Enum,EasingStyle.Sine,
Enum.EasingDirection.InOut,
- 1, -- Repeat forever
true -- Go backwards
)
local Part = workspace.Part -- You can change this to your instance.
-- Part will rotate between -45 and 45 in sine wave manner
local RAD_45 = math.rad(45)
local StartCFrame = CFrame.Angles(0,RAD_45,0) -- Set part to start at 45
local Goal = {
CFrame = CFrame.Angles(0,RAD_45 * 2,0) -- Should tween to
}
Part.CFrame *= StartCFrame -- SetupPart
local Tween: Tween = TweenService:Create(Part,TweenInformation,Goal)
Tween:Play()
I haven’t tested the code but I think it should work. This is how you would set it up. You can also try and look at other easing styles if the sine wave does not suit your style.