Hello, I’m looking to make a part stop at a wall when tweening, but I am not very experienced in
Raycasting to do so, could someone give me an example?
So far how I’m tweening is tweening a gray part to a red part’s CFrame & Size.


Here is my tweening code that I want to add the raycasting to:
local TS = game:GetService("TweenService")
local TSInfo = TweenInfo.new(
5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false
)
local TW = TS:Create(script.Parent.Part, TSInfo, {CFrame = script.Parent.TweenSize.CFrame})
local TW2 = TS:Create(script.Parent.Part, TSInfo, {Size = script.Parent.TweenSize.Size})
wait(2)
TW:Play()
TW2:Play()
How would I mix raycasting and tweening together? I want the raycast to come from the gray part
and then tween the red part’s size to how far the raycast goes.
