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

How to remove lag when Fire Projectile ?

Asked by 3 years ago
Edited 3 years ago

Hey, when my Projectile get spawned , It take like 1 sec before it start moving on the Clients.

What am I Doing Wrong ?

Script on the server that Fire the Projectile :

RE.OnServerEvent:Connect(function(player, direction)    
    -- Create projectile and give it velocity in the direction player is facing
    local projectile = game.ServerStorage.projectile:Clone()
    projectile.Parent = game.Workspace
    projectile:MakeJoints()
    projectile.PrimaryPart.CFrame = CFrame.new(player.Character.Tank_Cannon_1.Position + direction)
    projectile.PrimaryPart.Velocity = direction * 40 + Vector3.new(0,40,0)
    -- Set the server as the owner of the projectile
    projectile.PrimaryPart:SetNetworkOwner(nil)
end)

Answer this question