What do you want to achieve? I want to smoothly “throw” the tool without any lags
What is the issue? The tool is “lagged” when thrown
What solutions have you tried so far? Setting the network ownership to the player
function class.startThrow(player)
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild('Head') :: BasePart
local humanoid = character:FindFirstChildWhichIsA('Humanoid')
local heldTool = character:FindFirstChildWhichIsA('Tool')
local handle = class.getHandle(heldTool)
local prompt = handle and handle:FindFirstChildWhichIsA('ProximityPrompt') or nil
if not head or not humanoid or not heldTool or not handle or not prompt then return end
heldTool.Parent = workspace
handle:SetNetworkOwner(player)
handle.Position = head.Position + head.CFrame.LookVector * 10
handle.AssemblyLinearVelocity = head.CFrame.LookVector * CONSTANTS.THROW_POWER
prompt.Enabled = true
end
I tested it on the “Test” tab in roblox with 3 other players and when i throw it on Player 1, it’s smooth for me but for Player 2 and 3 it’s the same as before (in the video)
in that case i dont think theres a solution unless you want to make the projectile client sided and have all the clients have their own version of it. the downside of that however is that not all of them are going to have synced movement
The problem here is adding velocity on the server, the server has to replicate this to clients which will cause the “Lag”
To fix this add velocity on the client, if you want all clients to see. send a remote to all clients. if you want one client to see send it to the specific person!
When the client handles velocity it doesnt have to wait for the server to replicate it.
it does create issues like desync, and its not reliable since clients can manipulate the positions.
the part will also not be moved on the server if you replicate it to clients only.
when a new players joins for example and if you send the throw to all clients that were in the game then the new player wouldnt see.
for this you can use a hybrid approach make a reliable throwing mechanism with a end point. the server will move it to the end point. the client will create a throw, in turn creating a safe and clean throw!