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
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
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…
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
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.
local t = 1;
local mouse = game.Players.LocalPlayer:GetMouse();
local hrp = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild(“HumanoidRootPart”);
local bball = script.Parent:WaitForChild(“Handle”);
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
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