Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix the Instance.new("Part") lag when the part is given its velocity?

Asked by 6 years ago
Edited 6 years ago

The code is in a script

function activeCannon()
    local cloneProject = Instance.new("Part")                       
    cloneProject.Name = "OutputProject"
    cloneProject.Size = Vector3.new(1.25,1.25,1.25)
    cloneProject.Shape = "Ball"
    cloneProject.BrickColor = BrickColor.Black()
    --Shooter is where the projectile will spawn
    cloneProject.CFrame = script.Parent.Shooter.CFrame
    cloneProject.Parent = workspace
    cloneProject.Velocity = script.Parent.Shooter.CFrame.LookVector * 677
end

activeCannon()

When the projectile (cloneProject) is created, it first seem like it is anchored in the air for a moment (which means latency) and it resumes accelerating at its given velocity.

I tried to move the cloneProject.Velocity at the very first line in activeCannon() but I get the same issue.

How do I fix the latency issue?

Thanks

0
FYI: This is not a script in the tool. Its basically an automated cannon Psvita65594 -5 — 6y
0
Seems like the network owner of the object changed Rare_tendo 3000 — 6y
0
But the network owner is nil Psvita65594 -5 — 6y
0
The network owner will be the client that's nearby the projectile, and when it'll move too far from the player, the network owner will change to nil, thus causing a "hop" Rare_tendo 3000 — 6y
View all comments (6 more)
0
When I checked the server side, there wasn't a lot of latency. But on the client, there is. I also checked the network owner of the projectile and it is still nil, even before the velocity is set. Psvita65594 -5 — 6y
0
So I think it has something to do with the client side? Psvita65594 -5 — 6y
0
Maybe, one thing I recommend is to set the velocity before setting the parent. Always set the parent last no matter what you are doing. User#21908 42 — 6y
0
Because it causes lag to change the properties of a part and then replicate those to the clients in the server, it is generally best to set the parent property last. User#21908 42 — 6y
0
That is why the second parameter of Instance.new() is deprecated. User#21908 42 — 6y
0
Nope. Doesn't work. Has something to do with the client Psvita65594 -5 — 6y

Answer this question