Make part's size tween to end of raycast

How exactly would I make it so a part’s size is tweened to the end of the raycast?

Could you be more specific?

I’m assuming you mean to set the size of a part to the length of the casted ray? If this is the case, you could use TweenService in combination with RaycastResult.Position.

1 Like

Yes, but could I have an example, please?

local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist

local TweenSerivce = game:GetService("TweenService")
local TweewnInfo = TweenInfo.new(0.5,Enum.EasingStyle.Linear)

-- blacklist is essentially the same thing as ignore list
raycastParams.FilterDescendantsInstances = {}
-- put the stuff you want in the ignore list inside that table.

local origin, direction = -- origin/direction

local raycastResult = workspace:Raycast(origin, direction, raycastParams)
if raycastResult then -- it's nil if it doesn't hit anything, so check
	print(raycastResult.Instance) -- the part that it hit
	print(raycastResult.Position) -- the position where the ray hit
end

–Combine this and what you need from it within your code.

Still a bit confused on how I tween the size to the raycast.

local tween = game:GetService("TweenService"):Create(part,TweenInfo.new(1,Enum.EasingStyle.Linear),{Size = Vector3.new(raycast.Distance,0,0)
tween:Play()