I have this mostly working, however it doesn’t seem to be good 100% of the time. I’m mostly just wondering if there’s something I’ve forgot to add, or if some of my math is wrong.
Shapecasting:
local range = (script.Parent.Position - lastPosition).Magnitude
local damage = script.Parent.Damage.Value
local headshotMultiplier = 2
local bodyshotMultiplier = 1
local armshotMultiplier = 0.7
local legshotMultiplier = 0.8
local footshotMultipler = 0.15
local arms = {"RightUpperArm","RightLowerArm","RightHand","LeftUpperArm","LeftLowerArm","LeftHand"}
local legs = {"RightUpperLeg","RightLowerLeg","LeftUpperLeg","LeftLowerLeg"}
local feet = {"RightFoot","LeftFoot"}
local ig = {player.Character,workspace.Lasers:GetDescendants(),workspace.HitEffects:GetDescendants()}
local size = Vector3.new(1,1,1.7)
local paramaters = RaycastParams.new()
paramaters.FilterType = Enum.RaycastFilterType.Exclude
paramaters.FilterDescendantsInstances = ig
local rR = workspace:Blockcast(lastCF,size,lastCF.LookVector * range,paramaters)
Updating the position and firing the shapecast
RS.Stepped:Connect(function(delta)
lastPosition = projectile.Position
lastCF = projectile.CFrame
end)
RS.PostSimulation:Connect(function(delta)
shapeCast()
end)
EXTRA INFORMATION: The projectile is moved via a BodyVelocity (I know it’s deprecated Linear Velocity isn’t producing good results), the projectile is instantiated on the server, and whoever fired the projectile is set as the networkOwner.
Like I said it works most of the time, but not all the time; I have a feeling it may be due to roblox physics? Or maybe I should move the movement of the projectile entirely to the client and replicate it between clients…