BallService Module

BallService

BallService is a Server-Sided Module with Blade-Ball Simulation based.
(discontinued)

Github | Get Module | Test Place | version 2.4.0
Features
  • Easy to Use
  • Strict-typed
  • Efficiency workloads
  • Optimized performance (with --!native & other)
  • Curves (Vector3Curve (Linear Curve), Quadratic Curve, Cubic Curve)
  • Non-curve (Linear movement with TweenService)
  • Available with Parallel version
  • Customization Settings
  • Personalize (Trail, Color, Outline & Effects)
Example Usage
-- Server Side
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BallService = require(ReplicatedStorage:WaitForChild("BallService2P"):WaitForChild("BallService2"))
local Players = game:GetService("Players")

local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function()
		BallService:UpdatePlayers()
	end)
end)

game:GetService("Workspace").ChildAdded:Connect(function(child)
	if child and child.Name == "Dummy" and child:IsA("Model") then
		BallService:SetTest(true, game:GetService("Workspace"):WaitForChild("Dummy"))
		BallService:UpdatePlayers()
	end
end)

BallService.OnStop:Connect(function()
	warn("BallService stopped, resuming..")
	repeat task.wait() until BallService.isPlayable
	BallService:Play()
end)

BallService.OnTargetDied:Connect(function(targetObject: Model)
	print(targetObject, "Died")
end)

BallService.OnBallHit:Connect(function(hit)
	print("Ball Hit:", hit)
end)

BallService:Set({
	DefaultPos = Vector3.new(11.85, 3.31, -7.84),
	Test = {
		TestDummy = game:GetService("Workspace"):WaitForChild("Dummy"),
		TestMode = true,
	},
	Curve = {
		UseCurve = true,
		CubicCurve = true,
		MaxHeightCurve = -20,
		MinHeightCurve = -20,
	},
	Silent = true,
})

task.wait(1)

BallService:init()
repeat task.wait() until BallService.isPlayable
BallService:Play()
print(BallService:IsPlaying())
print("Server Loaded")
-- Client Side
local Players = game:GetService("Players")
local PlayerGui = Players.LocalPlayer.PlayerGui
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BallService2 = require(ReplicatedStorage:WaitForChild("BallService2P"):WaitForChild("BallService2"))
local RunService = game:GetService("RunService")

BallService2:init()

RunService.RenderStepped:Connect(function()
	if Players.LocalPlayer and Players.LocalPlayer.Character then
		if BallService2:GetTarget() == Players.LocalPlayer.Character then
			BallService2:SetColor(Color3.fromRGB(255, 0, 0))
			BallService2:SetOutline(Color3.fromRGB(255, 0, 0))
			BallService2:SetFill(Color3.fromRGB(255, 0, 0))
			BallService2:SetTrail({Color3.fromRGB(255, 0, 0)})
		else
			BallService2:SetColor(Color3.fromRGB(255, 255, 255))
			BallService2:SetOutline(Color3.fromRGB(255, 255, 255))
			BallService2:SetFill(Color3.fromRGB(255, 255, 255))
			BallService2:SetTrail({Color3.fromRGB(255, 255, 255)})
		end
	end
end)

print("Client Service Loaded")
Gameplay Test

Streamable (video & non-curved simulation)
Veed.io (alternative video & non-curved simulation)

Note > You may have to make own system to block the ball, but there sample i have made for this on Test Place.


Would you use this?

  • Yes
  • Later
  • No

0 voters


Rate BallService

  • Excellent
  • Well
  • Bad

0 voters

22 Likes

Great resource! but I don’t think they use tweening on the ball.

6 Likes

As a person who loves balls a lot, I see this resource as an absolute win, BallService is so cool.

15 Likes

Oof, I can’t correctly read the code of this module, use osyrisrblx/t instead of this

	if not easingStyle then error("Missing argument #1", 2) end
	if typeof(easingStyle) ~= "EnumItem" then error(`Expected type of argument #1 as EnumItem got {typeof(easingStyle)}.`, 2) end
1 Like

BugFix v1.1

Commit Changes - v1.1

also available for wally package

1 Like

Change the default branch from main to master

edit: found a typo

1 Like

if they use own tween system that might happen some lags (or not smooth) or if they use :Lerp function i can guess the ball movement will not smoothly and :Lerp function is deprecated.

1 Like

I think they use velocity :person_shrugging:
Maybe you can make a method for us devs to choose if we want to use tweening or velocity for the ball.

Game like Blade Ball, it definitely has non-tween service physics. while the ball is slow you can outrun it, so i believe its just smart velocity manipulation to allow curving ball toward where you aim the camera

Yeah I’m pretty sure that in another post the co-dev (the person who scripted the ball movement) said that they don’t use tweens.

Still, cool module :+1:

Maybe Vector3Curve is something they might use?

1 Like

Lerp is not deprecated and still used.

5 Likes

i did some experiment and yeah, i will try to implement this on BallService for next version.


with Vector3 Curve Simulation

1 Like

Update - 2.0

  • Use Vector3Curve
  • Some settings changes
  • Minor Fix

Note: Curve might be bugged if the speed are to fast and short distance between person and target

Commit Changes - 2.0

Patch - 2.0.1

  • Some Changes

W module thank you for creating this

2 Likes

Hi,
Sweet creation!

Can you put it in a .rbxl file we can play with ?

Thanks

u can go to the Test Place and its editable (uncopylocked) for the .rbxl or live edit in studio

Minor Patch - v2.1

  • Fixed Curve bug

we added BallService v2.1 with Parallel version
BallService2 Parallel.rbxm (9.8 KB) or github

Commit Changes - 2.1