Essentially, I’m setting the part infront of the player’s rootpart, if they move, it’s still infront of them as usual, they turn, still infront of them.
However, the Issue I’m having is wanting to rotate the part based on it’s current rotation while still allowing it to follow/CFrame infront of the player’s root as usual.
Here is my current code, basically, a normal setting it infront of the player dealio contained inside a loop. How would I go about doing this and rotating the part?
I’m lerping it to smoothly move the part infront of the player, just ignore it as of now.
I just need to make it rotate somewhat quickly but not too quick however, I still want to try and see how I would do this myself. Basically, I just want to try and rotate the part infront of the player dependent on it’s rotation constantly while setting it infront of the player constantly at the same time.
a way I would to it is to have it update every frame to put it in front of the character then have the part’s orientation the same as the humanoidrootpart or torso
I probably should’ve added the Stepped before hand but now I did
Anyways, doing that does somewhat work however, it just leads to insane spinning speeds.
@coworkerplus, I want to have it spin instead of just setting it infront of the player. The positioning infront of the player is ok, that works perfectly fine, the spinning part is not working out so well.
well you could try doing something like Part.Orientation = HumanoidRootPart.Orientation + Vector3.new(x, y, z) I’ll test this then edit this message if it works or not. Well the one time I tried, it didnt work, but you could definitely try doing something like that with tweening, unless you want constant spin, then you could try using constraints or align orientation, I’d recommend constraints.
I might be sending the message across wrong but, I still want to keep it spinning however, I don’t want it to spin at uncontrollable speeds while inside the Stepped loop.
As I’ve said in the reply before, it leads to uncontrollable speeds since it is inside the loop. Setting it in a while true do loop with a wait() also doesn’t help. And I’m setting the value at 0.001 which changes nothing in its speed.
EDIT: Please read my post again, I’ve made the value 0.001, and yet it is still spinning like crazy.
here is the entire code i use: lua local Part = Instance.new("Part", character) Part.Anchored = true local Root = character:WaitForChild("HumanoidRootPart") local n = 0 while true do local Offset = Root.CFrame * CFrame.new(0, 0, -2) * CFrame.Angles(math.rad(n), 0, 0) Part.CFrame = Part.CFrame:Lerp(Offset, 0.8) n = n+1 if n == 360 then n = 0 end game:GetService("RunService").Heartbeat:Wait() end
Looking at the code, it seems as though you’re constantly adding a value of + 1 to the variable, wouldn’t that be bad as it keeps going bigger and bigger as time goes by to like 95028520528015?
@Painshinratensei, I’d rather not rely on physics and bodygyros/etc for this as I plan to use CFrames and some sine waves/etc