Is it possible to overcome this delay/stutter?

Greetings,

I am making a bomb as you can see from the video

Both tools contain the same script, 1 executed on the client (called Client) and the other on the server(called Server)

this is the script(written by EgoMoose)

local t = .6
local mouse = game.Players.LocalPlayer:GetMouse();
local hrp = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild(“HumanoidRootPart”);
local bball = script.Parent:WaitForChild(“Handle”);

script.Parent.Activated:Connect(function()

  local g = Vector3.new(0, -game.Workspace.Gravity, 0);
  local x0 = hrp.CFrame * Vector3.new(0, 2, -2)

  -- calculate the v0 needed to reach mouse.Hit.p
  local v0 = (mouse.Hit.p - x0 - 0.5*g*t*t)/t;

  -- have the ball travel that path
  local c = bball:Clone();
  c.Velocity = v0;
  c.CFrame = CFrame.new(x0);
  c.CanCollide = true;
  c.Parent = workspace;

end)

As you can see from the video, when the script is executed on the server it kinda stutters a bit at the start, the bomb stands for just a tiny bit in place, while it is nice and smooth clientside. Might be hard to see from the video with bad quality but i assure you there is a noticeable difference.

My question is, can this be avoided, circumvented or overcome in some way? Please advise

Thanks for your time

Apply this on the x and y axis of the camera

I am sorry I don’t understand. Could you please elaborate a bit more?

x represents the current time step, this is alpha in a sense and y represents the unit scalar it should be at

I still don’t follow what you mean. What exactly in roblox terms am i to do? Do something to the camera upon server event? Sorry i’m gonna need a bit more to understand

1 Like

when your event happens tell the cameras cframe to move x distance dependent on the current time step derived from the equation. I am not gonna give you code, im eating rice…

So i am supposed to edit the camera of each player every time i fire the event? that seems counter productive

well think of it from a logical perspective what are you actually doing when the users camera shakes

the camera doesn’t shake, the part just kinda hangs there a bit before it starts moving i can give you a link to the game so you can see for yourself if you like

could you send a link to a place where i can try this? it’s hard to tell from the recording

here

1 Like

that stutter is caused by network ownership, on the server script, when creating the bomb, set it’s network ownership to nil (server) so it doesn’t transfer to other clients.

Part:SetNetworkOwner(nil)

do this after parenting it to workspace

ok let me try that and then we’ll see

unfortunately nothing changed :frowning:

could you post both client and server scripts that work on this tool?

–local

local t = 1;
local mouse = game.Players.LocalPlayer:GetMouse();
local hrp = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild(“HumanoidRootPart”);
local bball = script.Parent:WaitForChild(“Handle”);

script.Parent.Activated:Connect(function()
print “fire server”

script.Parent.R:FireServer(mouse.Hit.p)

end)

–server

local t = .6;

local R = script.Parent.R

R.OnServerEvent:Connect(function(player, Pos)
print “recieved”
local hrp = player.Character:WaitForChild(“HumanoidRootPart”);

local bball = player.Character:WaitForChild(“Server”).Handle
print “2”
local g = Vector3.new(0, -game.Workspace.Gravity, 0);
local x0 = hrp.CFrame * Vector3.new(0, 2, -2)

– calculate the v0 needed to reach mouse.Hit.p
local v0 = (Pos - x0 - 0.5gt*t)/t;

– have the ball travel that path
local c = bball:Clone()
c.Trail.Enabled = true

c.Velocity = v0;
c.CFrame = CFrame.new(x0);
c.CanCollide = true;
c.Parent = workspace;
c:SetNetworkOwner(nil)

end)

weird, it shouldn’t lag after setting the network owner. are you sure there aren’t any errors?
did you try it in a published place? what other kind of lag are we talking about?

well it IS in a published place, you can test it yourself in the link provided above. I don’t think it’s lag exactly, more like the server is slow to apply the velocity to the part, honestly it’s driving me crazy yet i’ve got no solutions

do you wanna try applying velocity after you set the network owner?

no effect :frowning: thank you very much for trying to help me but i must go to sleep, hopefully i’ll find a solution tomorrow

1 Like