I have this problem where my projectiles stop before hitting on client side
Server side:
Client side:
Code (Server script):
if not Character:FindFirstChild("Humanoid") then return end
if not Character:FindFirstChild("HumanoidRootPart") then return end
if Character.Humanoid.Health < 0 then return end
if not Character:FindFirstChild("RightHand") then return end
local RightHand = Character.RightHand
local energyball = self.energyball:Clone()
local PrimaryPart = energyball.PrimaryPart
PrimaryPart.CFrame = RightHand.CFrame
energyball.Part.CFrame = PrimaryPart.CFrame
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(1, 1, 1) * 350
BodyVelocity.Velocity = (PrimaryPart.Position - position).unit * -50
BodyVelocity.Parent = PrimaryPart
local touched = {}
PrimaryPart.Touched:Connect(function(toucher)
local Parent = toucher.Parent
if Parent == nil then return end
if touched[Parent.Name] then return end
if Parent:IsA("Workspace") then
PrimaryPart.Anchored = true
elseif Parent:FindFirstChild("Humanoid") and Parent ~= Character then
PrimaryPart.Anchored = true
touched[Parent.Name] = true
Parent.Humanoid:TakeDamage(self.damage)
end
end)
What can I do to fix this issue?