Basically like how a gun triggers and people's guns don't stop just because of their bad internet, how can I use this script in order to have it so that regardless of a person's ping, it'll still function normally with a person who has bad ping?

LocalScript

sp = script.Parent

local player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")

function onActivated()
	local shootevent = sp.ShootEvent
	local mousehit = player:GetMouse().Hit.p
	shootevent:FireServer(mousehit)
end

while wait() do
	script.Parent.Activated:wait()
	connection = RunService.Stepped:Connect(onActivated)
end

Server Side Script

local sp = script.Parent.Parent
local Tool = sp
local shoot = (sp.ShootEvent)

local powerval = Tool.PowerValue

local db = false
shoot.OnServerEvent:Connect(function(player, targetPos)
	script.Disabled = false
	if db == false then
	db = true
	sp.BallHandler.Value = player.Name
	local character = player.Character;
	local humanoid = character.Humanoid
	if humanoid == nil then
	print("Humanoid not found")
	return 
	end	
	local lookAt = (targetPos - character.Head.Position).unit
	local spos = character.PrimaryPart.Position
	local spawnPos  = spos + (lookAt * 5)
	Tool.Parent = workspace
	Tool.Handle.Position = spawnPos --Usually where people with bad ping will have issues.
	Tool.Handle.Velocity = (lookAt * powerval.Value) + Vector3.new(0,50,0)
	wait()
	db = false
	end
end)

Thanks,

LukeGabrieI