I have been making a weapon for my game where you shoot a small projectile to wherever your mouse but I have an issue where the projectile is spawning at the players previous position rather than their current position when they are moving ive looked at other games with projectiles and this does not seem to be an issue im aware that is has to do with server and client having a delay when connecting with each other so i was wondering if there was a way to speed up the transfer of data or just have an offset when the player is moving here is a clip of this happening
and this is my code
clientside
local Players = game:GetService("Players")
local player = Players.LocalPlayer
currentCam = workspace.CurrentCamera
local InitialForce = Vector3.new(150,0,0)
local Mouse = player:GetMouse()
tool.Activated:Connect(function()
game.ReplicatedStorage.point:FireServer(currentCam.CFrame, Mouse.Hit.Position, InitialForce)
end)
severside
local Javelin = game.Workspace.Javelin
local tool = script.Parent
game.ReplicatedStorage.point.OnServerEvent:Connect(function(player, currentCamCF, MouseCFrame, IForce)
local NewJav = Javelin:Clone()
NewJav.Parent = game.Workspace
NewJav.Anchored = false
NewJav:SetNetworkOwner(player)
NewJav.CFrame = CFrame.lookAt(tool.Handle.Position + Vector3.new(0,0,-2), MouseCFrame)
NewJav.VectorForce.Force = IForce
task.wait(.1)
NewJav.VectorForce.Force = Vector3.new(0,0,0)
NewJav.Touched:Connect(function(part)
local hum = part.Parent:FindFirstChild("Humanoid")
if hum then
hum.Health = 0
end
end)
end)
ignore the fact that its all in a code bit idk why its doing this their separate though