how to make a ball easy to move without it feeling weird, I tried using bodyVelocity but it felt weird if not weirder
local ball = script.Parent
local function onTouch(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = Vector3.new(50, 0, 50) -- Adjust the velocity as needed
bodyVelocity.MaxForce = Vector3.new(4000, 4000, 4000)
bodyVelocity.Parent = ball
task.wait(0.01)
bodyVelocity:Destroy()
end
end
ball.Touched:Connect(onTouch)
It’s a tad bit difficult to figure out what “wierd” means here without a demonstration. Maybe try adding a video of what you mean and describe what part you don’t like about it. In the meantime, I’ll just assume you mean that balls don’t seem to respond immediately to players pushing them around.
If that’s the case, then I’ve found it’s because of how inconsistent replicating physics data is between servers and clients. On the player’s screen, they’re pushing the ball. In the server’s eyes, the player isn’t even touching the ball until a tiny bit later. It then takes even longer for the server to then replicate the effects the player imparted onto the ball back to the player, resulting in parts that don’t immediately respond to the player. You should read Roblox’s article on network ownership if you want to learn more.
I believe that simply setting the network ownership to the player pushing the ball will make it far more responsive. Given enough time and that you haven’t altered any default settings, the game already does that automatically. Trying to script your own detection system for who to listen to is a bit redundant, so I suggest just letting Roblox do its thing.
Of course, that means only one player will be able to reliably control the ball. Other players will have an even worse time trying to take control of it. Given how Roblox is designed, though, I don’t know if there’s much you can do in ways of forcing it to work. The best I can offer would be to design your game in such a way that players won’t need to try and take control of the ball or to avoid relying on physics for whatever mechanic you’ll be using this on.
I’ll keep searching for a way to make that automatic behavior happen a little sooner, though. If I find anything, I’ll edit this paragraph to say it.
Are you sure the parts are under the pushing player’s network ownership? You can verify this by turning on the network ownership visualization mode and making sure the colors highlighting the parts are the same as the ones highlighting the player.
If they’re still lagging, I would assume that it’s due to some other factor, like an excessive number of parts being under the player’s network ownership. Other than that, I can’t really think of any other causes at the moment.