How to get the thickness of a Part

yes, but i have no idea on how to do this with the FastCast module that im using, this is the code that i currently have:

local FastCast = require(game.ReplicatedStorage.FastCastRedux)
local Rounds = workspace.TankRounds
local Caster = FastCast.new()

local TankRoundInfo = {
	APFSDS = {
		CanPen = 500
	},

}

-- Configs
local Speed = 100
local CastParams = RaycastParams.new()
local CastBehavior = FastCast.newBehavior()
local Bullet = Instance.new("Part")
Bullet.Shape = "Ball"
Bullet.Material = Enum.Material.Neon
Bullet.Color = Color3.new(1, 0, 0)
Bullet.Size = Vector3.new(0.5,0.5,0.5)
Bullet.Anchored = true
Bullet.CanCollide = false
Bullet.Name = "APFSDS"
Bullet.Parent = Rounds

CastBehavior.Acceleration = Vector3.new(0,-(Speed/100),0)
CastBehavior.CosmeticBulletContainer = Rounds
CastBehavior.CosmeticBulletTemplate = Bullet

CastParams.FilterType = Enum.RaycastFilterType.Blacklist
CastParams.IgnoreWater = true
CastParams.FilterDescendantsInstances = {Rounds}

local UpdateBullet = function(cast, lastPoint, direction, length, speed, bullet)
	if bullet then
		local BulletLength = bullet.Size.Z/2
		local Offset = CFrame.new(0,0,-(length - BulletLength))
		bullet.CFrame = CFrame.lookAt(lastPoint, lastPoint+direction):ToWorldSpace(Offset)
	end
end
Caster.LengthChanged:Connect(UpdateBullet)

local RoundHit = function(cast, result, speed, bullet)
	local Hit = result.Instance

-- Check if the bullet can pen the the armor

	game:GetService("Debris"):AddItem(bullet,0)
end
Caster.RayHit:Connect(RoundHit)



local Fire = function()
	local Origin = workspace.Gun.FirePoint.WorldPosition
	local EndPoint = (workspace.Gun.EndPoint.WorldPosition - Origin).Unit
	Caster:Fire(Origin,EndPoint,Speed,CastBehavior)
end
game.ReplicatedStorage.FireGun.OnServerEvent:Connect(Fire)

1 Like