You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Trying to rotate attachments for a effect video/image below.
What is the issue? Include screenshots / videos if possible!
This Goin crazy.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have no idea why this is Happening.
for i, att in ipairs(AutoAttackAura:GetChildren()) do
print(att)
if att:IsA("Attachment") then
local pe = att:FindFirstChildOfClass("ParticleEmitter")
if pe.Name == "2" then
att:FindFirstChild("2").Size = sizeSequence
else
pe.Size = sizeSequence1
end
AutoAttackAura:GetPropertyChangedSignal("Parent"):Connect(function()
print("unbind")
AAaura = nil
RS:UnbindFromRenderStep("RotateAutoAttackAura"..pe.Name)
end)
local rotValue = att.Name == "Outer" and -.3 or .3
RS:BindToRenderStep("RotateAutoAttackAura"..pe.Name..i, Enum.RenderPriority.Camera.Value, function()
att.Rotation+= Vector3.new(rotValue,0,0)
end)
end
end
local RS: RunService = game:GetService("RunService")
local function Lerp(a: number, b: number, t: number): number
return a + (b - a) * math.clamp(t, 0, 1)
end
for i, att in ipairs(AutoAttackAura:GetChildren()) do
print(att)
if att:IsA("Attachment") then
local pe = att:FindFirstChildOfClass("ParticleEmitter")
if pe.Name == "2" then
att:FindFirstChild("2").Size = sizeSequence
else
pe.Size = sizeSequence1
end
AutoAttackAura:GetPropertyChangedSignal("Parent"):Connect(function()
print("unbind")
AAaura = nil
RS:UnbindFromRenderStep("RotateAutoAttackAura"..pe.Name)
end)
local rotValue = if att.Name == "Outer" then Lerp(att.Rotation.X, att.Rotation.X + .3, .05) else Lerp(att.Rotation.X, att.Rotation.X - .3, .05)
RS:BindToRenderStep("RotateAutoAttackAura"..pe.Name..i, Enum.RenderPriority.Camera.Value, function()
att.Rotation+= Vector3.new(rotValue,0,0)
end)
end
end
Hey, I found out what the issue is. It’s happening when the particle emitter emits particles at different times. The particles are locked to the emitter, so when the attachment rotates, all the particles rotate, creating this super-fast speed effect.
I have them locked to the part but they still somehow got some difference in spawn time and starts to go crazy like in the video. This many happing when character collides with something and its angles changes slightly.
I think they need them locked so when the character walks the effect follows.
You should multiply this by delta time so it’s frame independent (otherwise it goes twice as fast for people running 60 fps compared to people with 30 fps):
local rotValue = att.Name == "Outer" and -.3 or .3
RS:BindToRenderStep("RotateAutoAttackAura"..pe.Name..i, Enum.RenderPriority.Camera.Value, function(deltaTime)
att.Rotation+= Vector3.new(rotValue,0,0) * deltaTime * 30 -- Added a 30 so it rotates at about the same speed still
end)
Is it possible you’re creating multiple connections? Maybe try adding:
local rotValue = att.Name == "Outer" and -.3 or .3
RS:BindToRenderStep("RotateAutoAttackAura"..pe.Name..i, Enum.RenderPriority.Camera.Value, function(deltaTime)
att.Rotation+= Vector3.new(rotValue,0,0) * deltaTime * 30 -- Added a 30 so it rotates at about the same speed still
end)
EDIT:
Is the problem that your bind to step names aren’t correct?
The name you create it with is: "RotateAutoAttackAura"..pe.Name..i but the name of the connection you try to remove is "RotateAutoAttackAura"..pe.Name, which doesn’t have the ..i in it.
Hey, I’ve fixed the name in the RS:UnbindFromRenderStep() function, but I think the reason why it’s happening is because particles are spawning at different times somehow. Also im using delta.
I’m not exactly sure why this would cause the spinning (though honestly I’m totally lost on that), but you can use ParticleEmitter:Emit to completely control when the particles spawn (with Enabled set to false).
If you’re using ParticleEmitter.RotSpeed for the spinning, make sure you have the number range set to a single value if you want the speeds to always be the same.