BallService Module

This is such a great open source module! I love how ballservice lets me play around with balls!

5 Likes

2.2 will be added quadratic curve with alpha and come some fixes, Vector3Curve are linear curve.

Update - 2.2

  • Using --!native for better performance
  • Settings Changes & Adds
  • Add :SetOutline
  • Add :SetTrail
  • Add :SetEffects
  • Add :Anchor & :Freeze
  • Add :SetTest
  • Add Quadratic Curve System
  • Add Cubic Curve System
  • Minor Fix RunService Module type
  • Other Fixes
  • More??

Commit - 2.2

also apply to parallel version.

hey, how about linear curve? in blade ball it looks linear to me.

use Vector3Curve for linear, if not that one then u mean non-curved with EasingStyle (u can off UseCurve option).


Minor BugFix - v2.2.1

that second image you sent its fine, its just type issue, you can do --!nostrict or removing --!strict to your Script (not the ballservice module)

yeah i sent it incase there’s something related to the issue

Does it automatically set the cooldown of the block or do I have to do that myself?

no it dont automatic for the cooldown, you have to do it ur self. like i said u have to make ur self blocking system.

v2.3.0

  • Now Ball wont curve (only when the ball just spawned)
  • Add .OnBallHit Signal
  • Add .OnTargetDied Signal
  • Add Exceptions (:Excepts, :RemoveExcepts & :IsExcept)
  • Other Fixes

Commit - 2.3.0

Can you make a function to get the current ball speed then

for what? and you can do this instead

print(BallObject.Speed.Value)
1 Like

Okay thanks I didnt know there was a value inside of the ballobject

Minor Update - 2.4.0

  • Get Players Target from LookVector (Auto, Internal)
  • Add :GetSpeed() Function

Commit - 2.4.0
Release - 2.4.0

Blade ball uses mouse.position for the target…

LookVector is better for my opinion to get bunch of objects and get random from the object received.

i will be not continue this module, but before that tmr i will push last update for minor bugfix.

With Root LookVector
task.wait(3.5)
local player = game:GetService("Players")
local past = nil
local ball = game:GetService("Workspace"):WaitForChild("Ball")
local target = nil
local direction = nil
local objects = {
	game:GetService("Workspace"):WaitForChild("Rig"),
	game:GetService("Workspace"):WaitForChild("Rig2"),
	game:GetService("Workspace"):WaitForChild('Rig3'),
	game:GetService("Workspace"):WaitForChild('Rig4'),
	game:GetService("Workspace"):WaitForChild('Rig5'),
	game:GetService("Workspace"):WaitForChild('Rig6'),
}

local speedVelocity = 5
local alpha = 0
local maxspeed = 25

function randomTarget(previous)
	local new = previous
	while (new == previous) do
		new = objects[math.random(1, #objects)]
	end
	return new
end

local function updateBallPosition(delta)
	if not target then
		target = randomTarget(target)
	end
	if target then
		if (target.PrimaryPart.Position - ball.Position).Magnitude <= 2 then
			past = target
			direction = past.PrimaryPart.CFrame
			target = randomTarget(target)
			alpha = 0
			speedVelocity *= 1.1
		end
		if past then
			local playerDirection = direction.LookVector
			local targetDirection = (target.PrimaryPart.Position - ball.Position).Unit
			ball.LinearVelocity.MaxForce = math.huge
			ball.LinearVelocity.VectorVelocity = (targetDirection + (playerDirection:Lerp(targetDirection, 0.5)) * 2) * math.min(maxspeed, speedVelocity)
		else
			alpha += delta
			ball.Position = ball.Position:Lerp(target.PrimaryPart.Position, math.min(1, alpha))
		end
	end
end

player.PlayerAdded:Connect(function(plr)
	task.wait(1)
	table.insert(objects, plr.Character)
end)

game:GetService("RunService").PostSimulation:Connect(updateBallPosition)
With Camera LookVector
task.wait(3.5)
local players = game:GetService("Players")
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild('RemoteEvent')
local ball = game:GetService("Workspace"):WaitForChild("Ball")
local past = nil
local target = nil
local direction = nil
local playerFacing = {}
local objects = {
	game:GetService("Workspace"):WaitForChild("Rig"),
	game:GetService("Workspace"):WaitForChild("Rig2"),
	game:GetService("Workspace"):WaitForChild('Rig3'),
	game:GetService("Workspace"):WaitForChild('Rig4'),
	game:GetService("Workspace"):WaitForChild('Rig5'),
	game:GetService("Workspace"):WaitForChild('Rig6'),
}

local speedVelocity = 5
local alpha = 0
local maxspeed = 25

function randomTarget(previous)
	local new = previous
	while (new == previous) do
		new = objects[math.random(1, #objects)]
	end
	return new
end

local function updateBallPosition(delta)
	playerFacing[workspace.Rig] = workspace.Rig.PrimaryPart.CFrame
	playerFacing[workspace.Rig2] = workspace.Rig2.PrimaryPart.CFrame
	if not target then
		target = randomTarget(target)
	end
	if target then
		if (target.PrimaryPart.Position - ball.Position).Magnitude <= 2 then
			past = target
			direction = playerFacing[target]
			target = randomTarget(target)
			alpha = 0
			speedVelocity *= 1.1
		end
		if past and direction then
			local targetDirection = (target.PrimaryPart.Position - ball.Position).Unit
			ball.LinearVelocity.MaxForce = math.huge
			ball.LinearVelocity.VectorVelocity = (targetDirection + (direction.LookVector:Lerp(targetDirection, 0.5)) * 2) * math.min(maxspeed, speedVelocity)
		else
			alpha += delta
			ball.Position = ball.Position:Lerp(target.PrimaryPart.Position, math.min(1, alpha))
		end
	end
end

function stringtoCFrame(str)
	return CFrame.new(table.unpack(str:gsub(" ",""):split(",")))
end

players.PlayerAdded:Connect(function(plr)
	task.wait(1)
	table.insert(objects, plr.Character)
end)

RemoteEvent.OnServerEvent:Connect(function(plr: Player, pos: string)
	playerFacing[plr] = stringtoCFrame(pos)
end)

game:GetService("RunService").PostSimulation:Connect(updateBallPosition)

made it with Roblox Assistant but i made some customization for better curving, btw its using LinearVelocity. (its server sided)

Example: