What’s Up.
So i had This issue With my Game where the Ball goes Slowly and Laggy, It’s Definetly Not Supposed to be Slow and Laggy but For me it Is
Heres the Scripts for More info!
Local:
local hitboxsize = Vector3.new(4, 5, 4)
local uis = game:GetService("UserInputService")
local dbs = game:GetService("Debris")
local db = false
local hrp = script.Parent:WaitForChild("HumanoidRootPart")
local hitanim = script:WaitForChild("Hit")
local plr = script.Parent
local loadedanim = plr:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(hitanim)
uis.InputBegan:Connect(function(i, gpe)
if gpe then return end
if db then return end
if i.UserInputType == Enum.UserInputType.MouseButton1 then
db = true
local VisualHitbox = Instance.new("Part") -- For Visual Effect. Not the Actual Hitbox
local cframe = hrp.CFrame + hrp.CFrame.LookVector * 1.3
VisualHitbox.Size = hitboxsize
VisualHitbox.Transparency = 0.5
VisualHitbox.CanCollide = false
VisualHitbox.CastShadow = false
VisualHitbox.CanQuery = false
VisualHitbox.Anchored = true
VisualHitbox.Color = Color3.new(1, 0, 0)
VisualHitbox.CFrame = cframe
VisualHitbox.Parent = workspace
local camera = workspace.CurrentCamera.CFrame.LookVector.Y
local Hitbox = workspace:GetPartBoundsInBox(cframe, Vector3.new(4, 5, 4))
game.ReplicatedStorage:WaitForChild("RemoteEvent"):FireServer(camera, Hitbox)
loadedanim:Play(0.1)
dbs:AddItem(VisualHitbox, 0.3)
task.wait(0.45)
db = false
end
end)
Global:
game.ReplicatedStorage:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(plr, camera, Hitbox)
local hrp = plr.Character:FindFirstChild("HumanoidRootPart")
local cframe = hrp.CFrame + hrp.CFrame.LookVector * 1.3
local clampedcamera = math.clamp(camera, -0.5, 0.5) -- UNFINISHED
for _, v in pairs(Hitbox) do
if v.Name == "Ball" and v.Parent == workspace then
local mass = v.AssemblyMass
v.AssemblyLinearVelocity = hrp.CFrame.LookVector * 180 * mass + Vector3.new(0, 150 * mass, 0)
v.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
if v.AssemblyLinearVelocity.Magnitude >= 50 then
game.ReplicatedStorage.KickTooFast:FireClient(plr) -- Anti-Cheat
end
end
end
end)