I have look at this post but I couldn’t understand how.
script.Parent.FireProjectile.Event:Connect(function(ToolData, tool, firePoint, hitPosition)
local caster = FastCast.new()
FastCast.VisualizeCasts = ToolData.DebugMode
local castBehavior = FastCast.newBehavior()
castBehavior.RaycastParams = castParams
castBehavior.Acceleration = Vector3.new(0, ToolData.EffectGravity, 0)
castBehavior.AutoIgnoreContainer = false
castBehavior.MaxDistance = ToolData.MaxDistance
castBehavior.CosmeticBulletContainer = projectilesFolder
castBehavior.CosmeticBulletTemplate = ToolData.Projectile
castParams.FilterDescendantsInstances = {tool.Parent, projectilesFolder}
caster.LengthChanged:Connect(function(cast, lastPoint, direction, length, velocity, projectile)
if projectile then
local projectileLength = (projectile.Size.Z/2)
local offset = CFrame.new(0, 0, -(length - projectileLength))
projectile.CFrame = CFrame.lookAt(lastPoint, lastPoint + direction):ToWorldSpace(offset)
end
end)
caster.RayHit:Connect(function(cast, result, velocity, projectile)
end)
local orgin = firePoint.WorldPosition
local direction = (hitPosition - orgin).Unit
caster:Fire(orgin, direction, ToolData.BulletSpeed, castBehavior)
end)
What I want: