I basically made a ball that is pushed by being close to the ball, but when pushing it, it kind of locks or teleports close, and I don’t want this because it’s not a fluid movement.
LocalScript:
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Mouse = LocalPlayer:GetMouse()
local Radius = 6
UIS.InputEnded:Connect(function(Input, gameprocess)
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
if (Character.HumanoidRootPart.Position - workspace.Ball.Position).Magnitude <= Radius then
RS.SendShoot:InvokeServer(Mouse.Hit.Position,80)
end
end
end)
ServerScript:
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
RS.SendShoot.OnServerInvoke = function(Player, PosMouse, ShootForce)
local Character = workspace:FindFirstChild(Player.Name)
if Character ~= nil then
workspace.Ball.CFrame = CFrame.lookAt(workspace.Ball.Position, PosMouse)
workspace.Ball.Velocity = workspace.Ball.CFrame.LookVector * ShootForce
end
end