Creating Projectiles From Server Stutter

So I am currently trying to make a projectile that is affected by gravity so I want it to be moved on the server so it is consistent across all clients. Currently, I am generating a part on the server side and then applying an impulse to it, but when the projectile is created, it freezes in midair for half a second on the client side before moving. How do I fix this?

server script:

game.ReplicatedStorage.Throw.OnServerEvent:Connect(function(player,cameraCframe)
	local Position = cameraCframe.Position + cameraCframe.LookVector * .25
	local ball = game.ReplicatedStorage.Ball:Clone()
	ball.CFrame = CFrame.new(Position)
	ball.Parent = game.Workspace
	ball.Velocity = cameraCframe.LookVector * 30
end)

client

local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Button1Down:Connect(function()
	game.ReplicatedStorage.Throw:FireServer(game.Workspace.CurrentCamera.CFrame)
end)

Also the file for the setup is here:
Baseplate.rbxl (34.3 KB)

1 Like

let the client handle the physics.

ball:SetNetworkOwner(player)

server code:

game.ReplicatedStorage.Throw.OnServerEvent:Connect(function(player,cameraCframe)
	local Position = cameraCframe.Position + cameraCframe.LookVector * .25
	local ball = game.ReplicatedStorage.Ball:Clone()
	ball.CFrame = CFrame.new(Position)
	ball.Parent = game.Workspace
	ball:SetNetworkOwner(player)
	ball.Velocity = cameraCframe.LookVector * 30
end)
2 Likes

This worked perfectly thanks!

–word count

3 Likes