I’ve been having trouble making this work every time I make a project that includes flashlights or needing a general reference part to display on the camera. How would I go about making a part’s CFrame Lerp to the camera’s CFrame? I have this code here that still doesn’t work
it’s simple yet doesn’t work
(edit)
My goal is to create a surface/spot light that illuminates off the camera in game using a part that follows the camera in a way but I’m not sure how to achieve this.
it is probably best to use TweenService for this instead.
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0)
local Tween = TweenService:Create(campart, tweenInfo, {CFrame = camera.CFrame})
Tween:Play()
I didn’t test this just keep that in mind
Would using tweenservice still work during renderstepped? I’d imagine it may cause like errors or overload of some kind
P.S: sorry should’ve made this more specific in the topic thread i’ll edit this now
oh yeah, I should’ve mentioned. don’t use it with renderstepped. The tween only needs to be played once until it’s done
oh, if your goal was to make a part that follows the camera then it would be best to set the CFrame of the lightpart to the CFrame of the camera every frame instead of using Lerp.
Thanks that worked perfectly idk why I never thought of this before I made it way more complicated then needed lol
glad I could help! you should set my answer to the solution so people don’t get confused though